游戏服平台配置如下:
[root@localhost ~]# vim /etc/rsyncd.conf
secrets file = /etc/rsyncd/.castlotpush_rsync.pwd
motd file = /etc/rsyncd/rsync.motd
read only = yes
list = yes
uid = root
gid = root
hosts allow = 192.168.1.253
hosts deny = 0.0.0.0/0
max connections = 2
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
[castlot_data]
comment = web folder
path = /data/castlot/client/
auth users = castlot_publish
read only =no
[root@localhost ~]# mkdir -p /etc/rsyncd/
[root@localhost ~]# mkdir -p /data/castlot/client/
[root@localhost ~]# vim /etc/rsyncd/.castlotpush_rsync.pwd
castlot_publish:8QNXEDy2
[root@localhost ~]# chmod 600 /etc/rsyncd/.castlotpush_rsync.pwd
[root@localhost ~]# ls -l /etc/rsyncd/.castlotpush_rsync.pwd
-rw------- 1 root root 25 02-17 17:24 /etc/rsyncd/.castlotpush_rsync.pwd
[root@localhost ~]# /usr/bin/rsync rsyncd --daemon --config=/etc/rsyncd.conf
服务器配置如下:
[root@localhost ~]# mkdir -p /etc/rsyncd/
[root@localhost ~]# vim /etc/rsyncd/.castlotpush_rsync.pwd
8QNXEDy2
[root@localhost ~]# chmod 600 /etc/rsyncd/.castlotpush_rsync.pwd
[root@bogon client]# rsync -vzrtopg --progress --delete-after /data/castlot/client/ castlot_publish@192.168.1.146::castlot_data/ --password-file=/etc/rsyncd/.castlotpush_rsync.pwd
building file list ...
4 files to consider
./
anaconda-ks.cfg
1474 100% 0.00kB/s 0:00:00 (xfer#1, to-check=2/4)
install.log
48175 100% 11.49MB/s 0:00:00 (xfer#2, to-check=1/4)
install.log.syslog
5773 100% 805.39kB/s 0:00:00 (xfer#3, to-check=0/4)
sent 13763 bytes received 68 bytes 27662.00 bytes/sec
total size is 55422 speedup is 4.01
常见错误:
用户密码错误
@ERROR: auth failed on module test
rsync error: error starting client-server protocol (code 5) at main.c(1503) [receiver=3.0.6]
检查存储密码文件是否出错
文件权限错误
password file must not be other-accessible
continuing without password file
Password:
@ERROR: auth failed on module ***
rsync error: error starting client-server protocol (code 5) at main.c(1503) [receiver=3.0.6]检查存储密码文件的权限是否为600, -rw-------
rsync: failed to connect to X.X.X.X: No route to host (113)
rsync error: error in socket IO (code 10) at clientserver.c(107) [sender=2.6.8]
故障原因:对方没开机、防火墙阻挡、通过的网络上有防火墙阻挡,都有可能。
解决方法:关闭防火墙,或者把防火墙的tcp udp 的873端口打开,允许rsync通过。
实施方案:
1、防火墙的启动与停止
# service iptables start / stop
2、允许rsync通过防火墙
为防重启将规则清除,我将规则直接加到规则配置文件里边了(/etc/sysconfig/iptables),如下:
-A INPUT -p tcp -s X.X.X.X --dport 873 -j ACCEPT
注意,这条规则要加在REJECT规则前。
加好后,重启下 iptables(# service iptables restart)。
转载于:https://blog.51cto.com/80888888/1333253