我们在 /usr/hdp/2.6.0.3-8/zookeeper 文件夹下有以下文件夹 / links /files
-rw-r--r--. 1 root root 794542 Apr 1 2017 zookeeper-3.4.6.2.6.0.3-8.jar
drwxr-xr-x. 6 root root 4096 Mar 28 2018 doc
drwxr-xr-x. 3 root root 17 Mar 28 2018 etc
drwxr-xr-x. 2 root root 4096 Mar 28 2018 lib
drwxr-xr-x. 3 root root 17 Mar 28 2018 man
lrwxrwxrwx. 1 root root 29 Mar 28 2018 zookeeper.jar -> zookeeper-3.4.6.2.6.0.3-8.jar
lrwxrwxrwx. 1 root root 26 Mar 28 2018 conf -> /etc/zookeeper/2.6.0.3-8/0
drwxr-xr-x. 2 root root 4096 Oct 16 17:07 bin
[root@master01 zookeeper]# pwd
/usr/hdp/2.6.0.3-8/zookeeper
我们想要将 /usr/hdp/2.6.0.3-8/zookeeper 下的所有内容复制到其他机器 - 比如说 - master02 机器
将 /usr/hdp/2.6.0.3-8/zookeeper 下的内容从当前计算机复制到目标计算机的正确命令是什么(保存所有链接和权限)
答案1
您可能正在寻找常用-a
的选项rsync
:
-a, --archive archive mode; equals -rlptgoD (no -H,-A,-X)
这将提供您所需要的:
-r, --recursive recurse into directories -l, --links copy symlinks as symlinks -p, --perms preserve permissions -t, --times preserve modification times -g, --group preserve group -o, --owner preserve owner (super-user only) -D same as --devices --specials --devices preserve device files (super-user only) --specials preserve special files
添加详细-v
程度选项,您将得到:
rsync -av /usr/hdp/2.6.0.3-8/zookeeper/ master02:/usr/hdp/2.6.0.3-8/zookeeper
您可能需要添加-delete
选项来清理目标目录:
--delete delete extraneous files from dest dirs