rsync服务建立和参数测试

##rsync 服务建立

在centos中,rsync是xinet管理的,要建立相关的配置文件

<pre> yum install rsync vim /etc/xinetd.d/rsync # default: off # description: The rsync server is a good addition to an ftp server, as it \ # allows crc checksumming etc. service rsync { disable = no flags = IPv6 socket_type = stream wait = no user = root server = /usr/bin/rsync server_args = --daemon log_on_failure += USERID } </pre>

##rsync配置

<pre> vim /etc/rsyncd.conf uid = root gid = root port = 873 hosts allow = 0.0.0.0/0 use chroot = max connections = timeout= pid file = /var/run/rsyncd.pid lock file = /var/run/rsync.lock log file = /var/log/rsyncd.log motd file = /etc/rsyncd.motd [test] path = /root/work/ auth users = rsync secrets file = /etc/rsync.passwd </pre>

这里有一点要注意,注释一定要另起一行,写在行末会发生诡异的错误

/etc/init.d/xinetd restart 启动服务

##远程同步

一般使用 rsync -hvarAEXHi --progress --stats --numeric-ids [USER@]HOST::SRC... [DEST] 命令

参数的作用在 man rsync 中都有详细的介绍,i参数不是一下子就能看明白的,这里详细说一下 参数i 有11个字母长的输出,使用YXcstpoguax说明,Y是更新方式,X是文件类型,其他的代表改过的属性 Y常出现的有:

> 表示文件是传到本地的 * 表示其他的字母包含一个信息(例如,‘deleting’)

X主要有:

f 表示文件 d 表示目录 L 表示链接

其他的字母:

+ 表示新创建的item . 表示同样的item ? 表示未知的item

例子如下:

<pre> >f+++++++++ src/etc/ssl/certs/ca-certificates.crt </pre>

表示 src/etc/ssl/certs/ca-certificates.crt这个文件,从远端传到本地。

<pre> *deleting test.dir/test.txt </pre>

表示test.dir/test.txt这个文件被删除

更多详细的资料参考 man rsync 这里非常的全面。

转载于:https://my.oschina.net/u/1432936/blog/189575

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值