首页 > 代码库 > 中小型规模网站集群架构:Rsync错误集
中小型规模网站集群架构:Rsync错误集
常见问题
3.1.1 rsync服务端排错思路
查看rsync服务配置文件路径是否正确,正确的默认路径为:/etc/rsyncd.conf
查看配置文件里host allow,host deny,允许的IP网段是否是允许客户端访问的IP网段。
查看配置文件中path参数里的路径是否存在,权限是否正确(正常应为配置文件中的UID参数对应的属主和组)
查看rsync服务是否启动。查看命令为:ps -ef | grep rsync。端口是否存在netstat -plunt| grep 873
查看iptables防火墙和selinux是否开启允许rsync服务通过,也可考虑关闭。
查看服务端rsync配置的密码文件是否为600的权限,密码文件格式是否正确,正确格式用户名:密码,文件路径和配置文件里的secrect files参数对应。
如果是推送数据,要查看下,配置rsyncd.conf文件中用户是否对模块下目录有可读写的权限。
3.1.2 rsync客户端排错思路
查看客户端rsync配置的密码文件是否为600的权限,密码文件格式shfou 正确,注意:仅需要有密码,并且和服务端的mima 一直
用telnet链接rsync服务器IP地址873查看服务是否启动(可测试服务端防火墙是否阻挡)
客户端执行命令是rsync -avz /etc/hosts rsync_backup@172.16.1.41::backup
此命令的细节要记清楚,尤其是双冒号
3.2 No route to host问题
[root@nfs01 ~]# rsync -avz /etc/hosts rsync_backup@172.16.1.41::backup rsync: failed to connect to 172.16.1.41: No route to host (113) rsync error: error in socket IO (code 10) at clientserver.c(124) [sender=3.0.6]
解决方案
服务端关闭防火墙
3.3 执行命令错误导致的报错
[root@nfs01 ~]# rsync -avz /etc/hosts rsync_backup@172.16.1.41::/backup ERROR: The remote path must start with a module name not a / rsync error: error starting client-server protocol (code 5) at main.c(1503) [sender=3.0.6]
解决:
rsync命令语法理解错误:/backup 必须是模块,也就是不能“/”
3.4 @ERROR: auth failed on module backup
[root@nfs01 ~]# rsync -avz /etc/hosts rsync_backup@172.16.1.41::backup Password: @ERROR: auth failed on module backup rsync error: error starting client-server protocol (code 5) at main.c(1503) [sender=3.0.6] [root@nfs01 ~]#
解决:
1.账号rsync_backup或者密码123456错误了。
2.指定的密码文件和实际的名称不一致。
secrets file = /etc/rsync.password
3.密码文件的权限忘记改为600
4.密码文件多了一个空格。 vi时候用set list或者用cat -A
3.5 @ERROR: Unknown module ‘backupa‘
[root@nfs01 ~]# rsync -avz /etc/hosts rsync_backup@172.16.1.41::backupa @ERROR: Unknown module ‘backupa‘ rsync error: error starting client-server protocol (code 5) at main.c(1503) [sender=3.0.6] [root@nfs01 ~]#
解决:
文件的模块和命令的模块不匹配
3.6 权限问题
[root@nfs01 ~]# rsync -avz /etc/hosts rsync_backup@172.16.1.41::backup Password: sending incremental file list rsync: ERROR: cannot stat destination "." (in backup): Permission denied (13) rsync error: errors selecting input/output files, dirs (code 3) at main.c(554) [receiver=3.0.6] rsync: connection unexpectedly closed (5 bytes received so far) [sender] rsync error: error in rsync protocol data stream (code 12) at io.c(600) [sender=3.0.6]
解决:
共享目录的属主和属组不正确,不是rsync
共享目录的权限不正确。不是755
3.7 没有创建对应的目录
[root@nfs01 ~]# rsync -avz /etc/hosts rsync_backup@172.16.1.41::backup Password: @ERROR: chdir failed rsync error: error starting client-server protocol (code 5) at main.c(1503) [sender=3.0.6]
解决:
看配置文件的目录和创建的目录是否对应(相同)
或者目录没有创建
3.8 ID或者用户组和用户组不存在
[root@nfs01 ~]# rsync -avz /etc/hosts rsync_backup@172.16.1.41::backup Password: @ERROR: invalid uid rsync rsync error: error starting client-server protocol (code 5) at main.c(1503) [sender=3.0.6]
解决:
创建rsync目录
3.9 客户端已经配置了密码文件,但免密钥登录方式,依旧需要输入密码
[root@nfs01 ~]# rsync -avz /etc/hosts rsync_backup@172.16.1.41::backup --password-file=/etc/rsync.password password file must not be other-accessible continuing without password file Password: sending incremental file list hosts rsync: mkstemp ".hosts.xWBidH" (in backup) failed: Permission denied (13) sent 196 bytes received 27 bytes 89.20 bytes/sec total size is 349 speedup is 1.57 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1039) [sender=3.0.6]
解决:
客户端的密码文件权限不是600
chmod 600 /etc/rsync.password
3.10 传输慢
看日志文件
2017/03/08 20:15:49 [25053] params.c:Parameter() - Ignoring badly formed line in configuration file: ignore errors 2017/03/08 20:15:49 [25053] name lookup failed for 172.16.1.31: Name or service not known 2017/03/08 20:15:49 [25053] connect from UNKNOWN (172.16.1.31) 2017/03/08 20:15:49 [25053] rsync to backup/ from rsync_backup@unknown (172.16.1.31) 2017/03/08 20:15:49 [25053] receiving file list 2017/03/08 20:15:49 [25053] rsync: mkstemp ".hosts.q63Fzr" (in backup) failed: Permission denied (13) 2017/03/08 20:15:49 [25053] sent 173 bytes received 253 bytes total size 349
解决:
配置本地域名解析/etc/hosts
172.16.1.31 nfs01
修改后
2017/03/08 20:17:46 [25056] params.c:Parameter() - Ignoring badly formed line in configuration file: ignore errors 2017/03/08 20:17:46 [25056] connect from nfs01 (172.16.1.31) 2017/03/08 20:17:46 [25056] rsync to backup/ from rsync_backup@nfs01 (172.16.1.31) 2017/03/08 20:17:46 [25056] receiving file list 2017/03/08 20:17:46 [25056] rsync: mkstemp ".hosts.CmOBRm" (in backup) failed: Permission denied (13) 2017/03/08 20:17:46 [25056] sent 173 bytes received 253 bytes total size 349
3.11 客户端目录权限644+rsync使用了avz参数
推送之后会给服务端的/backup目录修改权限。使服务端权限变成644导致传输失败。
sh [root@nfs01 ~]# echo 123456>/etc/rsync.password ash: 123456: Bad file descriptor
3.12
问题,服务没启动
[root@backup scripts]# rsync -avz /etc/hosts rsync_backup@172.16.1.41::allbackup rsync: failed to connect to 172.16.1.41: Connection refused (111) rsync error: error in socket IO (code 10) at clientserver.c(124) [sender=3.0.6]
解决:
rsync --daemon
未知错误
[root@nfs01 scripts]# rsync -az -delete /data/ rsync_backup@172.16.1.41::nfsbackup --password-file=/etc/rsync.password rsync: Failed to exec lete: No such file or directory (2) rsync error: error in IPC code (code 14) at pipe.c(84) [sender=3.0.6] rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: error in rsync protocol data stream (code 12) at io.c(600) [sender=3.0.6]
解决:重新写一下命令,就OK?
本文出自 “小菜鸟” 博客,请务必保留此出处http://baishuchao.blog.51cto.com/12918589/1948091
中小型规模网站集群架构:Rsync错误集