Rsync服务常见问题汇总讲解:(CentOS 6.5操作系统)
=========================================================================
1、客户端错误信息:No route to host
rsync客户端报错信息:
[root@localhost scripts]# rsync -avz [email protected]::oldboy /data/ --password-file=/etc/rsync.password
rsync: failed to connect to 10.90.3.115 (10.90.3.115): No route to host (113)
rsync error: error in socket IO (code 10) at clientserver.c(125) [Receiver=3.1.2]
异常问题解决:
关闭Rsync服务端的防火墙服务(iptables)
[root@localhost /]# service iptables stop
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Flushing firewall rules: [ OK ]
iptables: Unloading modules: [ OK ]
=========================================================================
2、ERROR: The remote path must start with a module name not a /
rsync客户端执行rsync命令错误:
[root@localhost /]# rsync -avz [email protected]::/oldboy /data/ --password-file=/etc/rsync.password
ERROR: The remote path must start with a module name not a /
rsync error: error starting client-server protocol (code 5) at main.c(1648) [Receiver=3.1.2]
异常问题解决:
rsync命令语法理解错误,::/oldboy是错误的语法,应该为:"::oldboy(rsync模块)"
=========================================================================
3、@ERROR: auth failed on module oldboy
客户端错误信息:
[root@localhost scripts]# rsync -avz [email protected]::oldboy /data/ --password-file=/etc/rsync.password
@ERROR: auth failed on module oldboy
rsync error: error starting client-server protocol (code 5) at main.c(1648) [Receiver=3.1.2]
异常问题解决:
1. 密码真的输入错误,用户名真的错误
2. secrets file = /etc/rsync.password指定的密码文件和实际密码文件名称不一致
3. /etc/rsync.password文件权限不是600
4. rsync_backup:oldboy123密码配置文件后面注意不要有空格
5. rsync客户端密码文件中只输入密码信息即可,不要输入虚拟认证用户名称
6、/etc/rsyncd.conf配置文件中的虚拟用户一定要存在,并且命令中的虚拟用户要正确
7、/etc/rsync.password密码文件权限不对,不是600权限。
=========================================================================
4、@ERROR: Unknown module 'oldboy'
客户端报错信息:
[root@localhost /]# rsync -avz [email protected]::oldboy /data/ --password-file=/etc/rsync.password
@ERROR: Unknown module 'oldboy'
rsync error: error starting client-server protocol (code 5) at main.c(1648) [Receiver=3.1.2]
异常问题解决:
1、/etc/rsyncd.conf配置文件中的模块名称书写错误
2、配置文件中的IP或网段限制错误
=========================================================================
5、Permission denied
客户端报错信息:
[root@localhost /]# rsync -avz [email protected]::oldboy /data/ --password-file=/etc/rsync.password
receiving incremental file list
rsync: link_stat "." (in oldboy) failed: Permission denied (13)
sent 8 bytes received 87 bytes 63.33 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1650) [Receiver=3.1.2]
异常问题解决:
1、共享目录的属主和属组不正确,不是rsync
2、共享目录的权限不对,不是755权限
=========================================================================
6、Connection refused (111)
客户端报错信息:
[root@localhost /]# rsync -avz [email protected]::oldboy /data/ --password-file=/etc/rsync.password
rsync: failed to connect to 10.90.3.115 (10.90.3.115): Connection refused (111)
rsync error: error in socket IO (code 10) at clientserver.c(125) [Receiver=3.1.2]
Rsync服务没有正确启动。
问题解决如下:
重启或启动rsync服务(服务端)
[root@localhost /]# rsync --daemon
[root@localhost /]# ps -ef|grep rsync
root 2543 1 0 04:15 ? 00:00:00 rsync --daemon
root 2546 1668 0 04:15 pts/0 00:00:00 grep rsync
[root@localhost /]# netstat -lnpt|grep rsync
tcp 0 0 0.0.0.0:873 0.0.0.0:* LISTEN 2543/rsync
tcp 0 0 :::873 :::* LISTEN 2543/rsync
=========================================================================
Rsync服务端排错思路:
1、查看rsync服务配置文件路径是否正确 /etc/rsyncd.conf
2、查看配置文件例的host allow,host deny,允许的ip网段是否是允许客户端访问的ip网段
3、查看配置文件中path参数里的路径是否存在,权限是否正确(正常应为配置文件中的UUID参数对应的属主和组)
4、查看rsync服务是否启动,端口是否存在 ps -ef netstat -lntup
5、查看iptables防火墙和SELinux是否开启允许rsync服务通过,也可以关闭
6、查看服务端rsync配置文件里的密码权限是否为600 密码文件格式是否正确,正确格式(用户名:密码)文件路径和配置文件里的secrect files 参数对应
7、如果是推送数据,要查看,配置rsyncd.conf 文件中用户是否对模块下目录有可读的权限
=========================================================================
客户端排错思路:
1、查看客户端rsync配置的密码文件是否为600的权限,密码文件格式是否正确,注意:仅需要有密码,并且和服务端的密码一致
2、用telnet链接rsync服务器ip地址873端口,查看服务是否启动(可测试服务端防火墙是否阻挡telnet10.0.0.100 873)
3、客户端执行命令是 rsync -avzP [email protected]::backup/test/test/ --password-file=/etc/rsync.password
4、此命令要记清楚尤其10.0.0.100::backup/test/处的双引号及随后的backup为模块名称