rsync配置及报错处理

服务器端配置文件:
首先安装rsync+xinetd
并启用/usr/bin/rsync --daemon
配置文件如下:
more /etc/rsyncd.conf
list = yes
uid = root
gid = root
use chroot = no
#strict modes = false
host_allow = *
max connections =200
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
#secrets file=/etc/rsyncd.secrets


[test]
path = /root/Test
read only = no
transfer logging = yes

下面配置文件:
more /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
        socket_type     = stream
        wait            = no
        user            = root
        server          = /usr/bin/rsync
        server_args     = --daemon
        log_on_failure  += USERID
}
改更要重启的: service xinetd restart 
客户端可能会存在以下报错。
[root@localhost /]# rsync -vzrtopg --delete --progress rsync\@192.168.1.106::test /cc
rsync: failed to connect to 192.168.1.106: Connection refused (111)
rsync error: error in socket IO (code 10) at clientserver.c(124) [receiver=3.0.6]


改了之后,客户端就可以正常同步了。
还有一个以下报错。
[root@localhost Test]# rsync -vzrtopg --delete --progress rsync\@192.168.1.106::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(600) [receiver=3.0.6]



以下内容来自http://tonykorn97.itpub.net/post/6414/462027
停止掉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

从日志上可以看到服务器已经启动。


经过这上面的提示,后解决了。

出现如下错误:
@ERROR: chdir failed
rsync error: error starting client-server protocol (code 5) at main.c(1296) [sender=2.6.8]
原因及解决方法:
test文件没有建,建后,同步成功。

还可能存在的问题
@ERROR: chdir failed
rsync error: error starting client-server protocol (code 5) at main.c(1296) [receiver=2.6.8]
原因及解决办法:
    SELinux;
    setsebool -P rsync_disable_trans on

猜你喜欢

转载自7shao.iteye.com/blog/1554669