已经做过好几台服务器的rsync配置了,可是有遇到了一个怪异的问题
rsync客户机同步的时候报错:
[root@tonykorn02 test]# /usr/bin/rsync -vzrtopg --progress --delete 192.168.1.250::test /test
rsync: connection unexpectedly closed (0 bytes received so far) [receiver]
rsync error: error in rsync protocol data stream (code 12) at io.c(463) [receiver=2.6.8]
服务端配置
[root@tonykorn ~]# uname -a
Linux tonykorn 2.6.18-53.el5 #1 SMP Wed Oct 10 16:34:19 EDT 2007 x86_64 x86_64 x86_64 GNU/Linux
[root@tonykorn ~]# cat /etc/issue
Red Hat Enterprise Linux Server release 5.1 (Tikanga)
Kernel r on an m
[root@tonykorn ~]# cat /etc/rsyncd.conf
uid = nobody
gid = nobody
use chroot = no
max connections = 4
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsyncd.lock
log file = /var/log/rsyncd.log
[test]
path = /test
ignore errors
read only = true
list = false
hosts allow = 192.168.1.252
hosts deny = 192.168.1.0/24
[root@tonykorn ~]#
客户机配置
[root@tonykorn02 ~]# cat /etc/issue
Red Hat Enterprise Linux Server release 5.1 (Tikanga)
Kernel r on an m
[root@tonykorn02 ~]# uname -a
Linux tonykorn02 2.6.18-53.el5 #1 SMP Wed Oct 10 16:34:19 EDT 2007 x86_64 x86_64 x86_64 GNU/Linux
[root@tonykorn02 ~]#
原来的版本:
[root@tonykorn test]# rpm -e rsync-2.6.8-3.1
warning: /etc/xinetd.d/rsync saved as /etc/xinetd.d/rsync.rpmsave
新安装的版本,
[root@tonykorn installfiles]# rpm -ivh rsync-2.6.3-1.x86_64.rpm
warning: rsync-2.6.3-1.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID db42a60e
Preparing... ########################################### [100%]
1:rsync ########################################### [100%]
[root@tonykorn installfiles]#
因为在redhat4u4上面同样的配置都可以运行,所以用redhat4u4中的rsync版本试试,更换服务端rsync版本还是一样的报错:
重启xinetd服务,查看日志信息:
May 15 12:54:57 tonykorn xinetd[7308]: Exiting...
May 15 12:54:57 tonykorn xinetd[16450]: bind failed (Address already in use (errno = 98)). service = rsync
May 15 12:54:57 tonykorn xinetd[16450]: Service rsync failed to start and is deactivated.
May 15 12:54:57 tonykorn xinetd[16450]: xinetd Version 2.3.14 started with libwrap loadavg labeled-networking options compiled in.
May 15 12:54:57 tonykorn xinetd[16450]: Started working: 2 available services
查看端口的使用情况:
[root@tonykorn posftp]# netstat -na | grep 873
tcp 0 0 0.0.0.0:873 0.0.0.0:* LISTEN
[root@tonykorn posftp]#
停止掉xinetd后查看端口的占用状态:
[root@tonykorn xinetd.d]# /etc/init.d/xinetd status
xinetd (pid 16964) is running...
[root@tonykorn xinetd.d]# /etc/init.d/xinetd stop
Stopping xinetd: [ OK ]
[root@tonykorn xinetd.d]# netstat -na | grep 873
tcp 0 0 0.0.0.0:873 0.0.0.0:* LISTEN
unix 3 [ ] STREAM CONNECTED 76873
[root@tonykorn xinetd.d]#
查看那个程序在使用这个端口:
[root@tonykorn xinetd.d]# netstat -lnp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:4001 0.0.0.0:* LISTEN 7376/backprice
tcp 0 0 0.0.0.0:8033 0.0.0.0:* LISTEN 3443/nsrindexd
tcp 0 0 0.0.0.0:7937 0.0.0.0:* LISTEN 3357/nsrexecd
tcp 0 0 0.0.0.0:4002 0.0.0.0:* LISTEN 7374/backpos
tcp 0 0 0.0.0.0:7938 0.0.0.0:* LISTEN 3354/nsrexecd
tcp 0 0 0.0.0.0:4004 0.0.0.0:* LISTEN 7387/tranmember
tcp 0 0 0.0.0.0:13253 0.0.0.0:* LISTEN 3358/lgtolmd
tcp 0 0 0.0.0.0:9382 0.0.0.0:* LISTEN 3361/nsrd
tcp 0 0 0.0.0.0:873 0.0.0.0:* LISTEN 2811/rpc.statd
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 2772/portmap
查找那个程序启动的这个端口,关闭这个服务
[root@tonykorn xinetd.d]# chkconfig --list | grep nfs
nfs 0:off 1:off 2:off 3:off 4:off 5:off 6:off
nfslock 0:off 1:off 2:off 3:on 4:on 5:on 6:off
[root@tonykorn xinetd.d]# service nfslock status
rpc.statd (pid 2811) is running...
[root@tonykorn xinetd.d]# service nfslock stop
Stopping NFS statd: [ OK ]
[root@tonykorn xinetd.d]# netstat -lnp | grep 873
[root@tonykorn xinetd.d]# netstat -na | grep 873
[root@tonykorn xinetd.d]#
重新启动xinetd服务
[root@tonykorn xinetd.d]# /etc/init.d/xinetd start
Starting xinetd: [ OK ]
[root@tonykorn xinetd.d]# vi /var/log/messages
May 15 13:27:50 tonykorn rpc.statd[2811]: Caught signal 15, un-registering and exiting.
May 15 13:28:52 tonykorn xinetd[18304]: xinetd Version 2.3.14 started with libwrap loadavg labeled-networking options compiled in.
May 15 13:28:52 tonykorn xinetd[18304]: Started working: 3 available services
从日志上可以看到服务器已经启动。
重新运行rsync成功
[root@tonykorn02 test]# /usr/bin/rsync -vzrtopg --progress --delete 192.168.1.250::test /test
receiving file list ...
848 files to consider
sent 66 bytes received 16509 bytes 33150.00 bytes/sec
total size is 204135093 speedup is 12315.84
[root@tonykorn02 test]#
google搜索的一些其他答案
http://samba.anu.edu.au/rsync/FAQ.html
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/312079/viewspace-1004084/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/312079/viewspace-1004084/