Client(192.168.1.3)--------------------àdaemon(192.168.1.2)
-----------------------配置过的先略过,直接看测试过程----------------
服务端配置:
/etc/rsyncd/Rsyncd.conf配置
# Minimal configuration file for rsync daemon
# See rsync(1) and rsyncd.conf(5) man pages for help
# This line is required by the /etc/init.d/rsyncd script
pid file = /var/run/rsyncd.pid
port = 873
address = 192.168.1.2
uid = test
gid = test
auth users = test
secrets file = /etc/rsyncd/rsyncd.secrets
#incoming chmod = u+rwx,g+rwx,o+rx
use chroot = yes
read only = no
#limit access to private LANs
hosts allow=192.168.1.3/255.255.255.255
hosts deny=*
max connections = 500
#This will give you a separate log file
log file = /var/log/rsync.log
#This will log every file transferred - up to 85,000+ per user, per sync
#transfer logging = yes
log format = %t %a %m %f %b
syslog facility = local3
timeout = 300
[app]
path = /app/test(目标目录)
list=yes
#ignore errors
/etc/rsyncd/rsyncd.secrets 配置
test:123456(密码)
启动服务端/usr/bin/rsync --daemon --config=/etc/rsyncd/rsyncd.conf
客户端配置
客户端:
/etc/rsync_client.pass
123456(密码)
rsync -av --password-file=/etc/rsync_client.pass /boot test@192.168.1.2::app
-------------------------------------------------------------配置完成-------------------------------------------------
测试过程:
rsync -av --password-file=/etc/rsync_client.pass /boot test@192.168.1.2::app
结果正确,没有出现问题
再进行
rsync -av --password-file=/etc/rsync_client.pass /home test@192.168.1.2::app
结果也正确,没有出现问题
再进行
rsync -av --password-file=/etc/rsync_client.pass /etc test@192.168.1.2::app
这回报错了
出现如下错误:
unexpected tag 3 [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(828)
[sender=2.6.8]
而此时服务端的错误日志如下:
2008/11/12 00:25:42 [12657] rsync: read error: Connection reset by peer (104)
2008/11/12 00:25:42 [12657] rsync error: error in rsync protocol data stream
(code 12) at io.c(614) [receiver=2.6.8]
2008/11/12 00:25:42 [12657] rsync: connection unexpectedly closed (486 bytes
received so far) [generator]
2008/11/12 00:25:42 [12657] rsync error: error in rsync protocol data stream
(code 12) at io.c(463) [generator=2.6.8]
再同步一次就成功。
把服务端下已经同步的文件删除,再不尝试一次
rsync -av --password-file=/etc/rsync_client.pass /etc test@192.168.1.2::app
还是报错。文件只同步了部分文件,发现在同步的源文件中如果文件数太多,或者子目录太多,就经常会出现这一种情况。
根据多次查找发现在2.6.8上会出现这一个问题,在2.6.9上已经解决,经查看在RedHat5.4,5.5和5.6的发行版中都是使用rsync-2.6.8的版本。
在官方上看到了更新日志
- Fixed a bug where a deferred info/error/log message could get sent directly to the sender instead of being handled by rwrite() in the generator. This fixes an "unexpected tag 3" fatal error, and should also fix a potential problem where a deferred info/error message from the receiver might bypass the log file and get sent only to the client process. (These problems could only affect an rsync daemon that was receiving files.)
Redhat上的bug报告文件如下:https://bugzilla.redhat.com/show_bug.cgi?id=471182
解决方法:
升级rsync到2.6.9以上,只需要升级服务器端就可以了!因为这一个bug只会影响服务端的接收。
在redhat5.7中已经默认修复了这一个问题。
推荐阅读: