rsync 客戶端同步的時候報錯

tonykorn97發表於2008-05-15

已經做過好幾臺伺服器的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]

[@more@]

服務端配置

[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搜尋的一些其他答案

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/312079/viewspace-1004084/,如需轉載,請註明出處,否則將追究法律責任。

相關文章