环境:某某项目的代码机器70配置有双网卡:232.182.23.70(联通)61.10.45.70(电信)
另一台代码机器是沧州联通的代码机器102,配置单网卡:121.15.1.102(联通)
rsync服务端服务器121.15.1.102上的配置文件rsyncd.conf
一开始/etc/rsyncd.conf 里面配置的允许ip:为61.10.45.70
[root@localhost tmp]# cat /etc/rsyncd.conf
##rsyncd.conf start##
uid = root
gid = root
port=873
use chroot = no
read only = no
list = no
max connections = 200
timeout = 300
auth users = stuser
hosts allow = 61.10.45.70
#hosts deny = *
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log
secrets file = /etc/rsync.pass
motd file = /etc/rsyncd.Motd
[sdkdhcode]
path = /data/www/sdkdhcode/
comment = sdkdhcode
看似一切正常,但是这样在配置好的rsync的同步环境就出问题了:
(61.10.45.70机器推送数据到121.15.1.102机器上)
[root@localhost tmp]# rsync -avH --port=873 --progress /opt/biao-framedb_backup.sh stuser@121.15.1.102::sdkdhcode --password-file=/tmp/lmpasswd.txt
@ERROR: Unknown module 'sdkdhcode'
rsync error: error starting client-server protocol (code 5) at main.c(1503) [sender=3.0.6]
原因是:rsync在同步中两台服务器的网卡寻找线路是联通找联通,电信的找电信的,而上面个的配置文件中添加的是的电信的ip地址:61.10.45.70,这样会导致61.10.45.70机器进行rsync传顺数据包到121.15.1.102机器上出问题,
于是把上面的rsyncd.conf配置文件中的 地址改为112.82.223.70(联通ip)就没问题了
解决上面的问题是从报错日志文件中发现:
tail -100f /var/log/rsyncd.log
2017/09/08 22:54:36 [85284] rsync denied on module code from unknown (232.182.23.70)
2017/09/08 22:56:37 [85314] name lookup failed for 232.182.23.70: Name or service not known
2017/09/08 22:56:37 [85314] connect from UNKNOWN (232.182.23.70)
2017/09/08 22:56:37 [85314] rsync denied on module code from unknown (232.182.23.70)
2017/09/08 22:57:03 [85318] name lookup failed for 232.182.23.70: Name or service not known
2017/09/08 22:57:03 [85318] connect from UNKNOWN (232.182.23.70)
本文转自 wjw555 51CTO博客,原文链接:http://blog.51cto.com/wujianwei/1964029