rsync同步出错以及解决办法。
1、@ERRPR:chdir failed
错误原因:
服务器端没有提供访问的目录 /backup
处理方法:
需要在服务器端创建,并赋予权限rsync管理权限
mkdir /backup
chown -R rsync.rsync /backup/
2、@ERROR: auth failed on module backup
查看 服务端/etc/rsync.password 配置文件是否有问题
比如:
多余的空格 空行
rsync error: error startingclient-serverprotocol (code 5) at main.c(1503) [sender=3.0.6]
错误原因
1> 客户端密码文件的权限不是600
2> 服务端密码文件不是600
3> 服务端密码文件不存在(名字写错了/没有创建/配置文件参数写错了)
4> 服务端密码文件里保存的用户名和密码不正确
3、@ERROR:invalid uid rsync
不可用的uid
useradd rsync -s /sbin/nologin -M
4、@ERROR: chroot failed
@ERROR:chroot failed
rsyncerror: error starting client-server protocol (code 5) at main.c(1522)[receiver=3.0.3]
服务器端的目录不存在或无权限,创建目录并修正权限可解决问题。
5、@ERROR: auth failed on module tee
rsync error: error starting client-serverprotocol (code 5) at main.c(1522) [receiver=3.0.3]
服务器端该模块(tee)需要验证用户名密码,但客户端没有提供正确的用户名密码,认证失败。
提供正确的用户名密码解决此问题。
6、@ERROR: Unknown module ‘tee_nonexists'
rsync error: error starting client-serverprotocol (code 5) at main.c(1522) [receiver=3.0.3]
服务器不存在指定模块。提供正确的模块名或在服务器端修改成你要的模块以解决问题。
1> 推送/拉取命令写错了
2> 服务端模块名字写错了
7、rsync: --passwork-file=/etc/rsync.password: unknown option
rsync: --passwork-file=/etc/rsync.password:unknown option
rsync error: syntax or usage error (code 1)at main.c(1422) [client=3.0.6]
错误原因:
/etc/rsync.password文件名称写错
解决方法:
更正/etc/rsync.password文件名称
8、rsync: ERROR:cannot stat destination
sending incremental file list
rsync: ERROR: cannot stat destination"." (in backup): Permission denied (13)
rsync error: errors selecting input/outputfiles, dirs (code 3) at main.c(554) [receiver=3.0.6]
rsync: connection unexpectedly closed (5bytes received so far) [sender]
rsync error: error in rsync protocol datastream (code 12) at io.c(600) [sender=3.0.6]
错误原因:
服务端rsync对目录操作权限不足
解决方法:
修改对应目录权限755
[root@oldboy~]# chmod 755 /backup/
[root@oldboy~]# ll -ld /backup/
drwxr-xr-x.12 rsync rsync 4096 Sep 23 19:17 /backup/
9、rsync: write failed on "/home/backup2010/ ": No space lefton device (28)
rsync:write failed on "/home/backup2010/wensong": No space left on device(28)
rsyncerror: error in file IO (code 11) at receiver.c(302) [receiver=3.0.7]
rsync:connection unexpectedly closed (2721 bytes received so far) [generator]
rsyncerror: error in rsync protocol data stream (code 12) at io.c(601) [generator=3.0.7]
问题原因:
磁盘空间不够,所以无法操作。
解决方法:
可以通过df /home/backup2010 来查看可用空间和已用空间
10、rsync: opendir "/kexue" (in dtsChannel) failed: Permissiondenied (13)
注意查看同步的目录权限是否为755
11、rsync: failed to connect to 203.100.192.66: Connection timed out(110)
rsync:failed to connect to 203.100.192.66: Connection timed out (110)
rsyncerror: error in socket IO (code 10) at clientserver.c(124) [receiver=3.0.5]
检查服务器的端口netstat ?tunlp,远程telnet测试。
可能因为客户端或者服务端的防火墙开启 导致无法通信,可以设置规则放行 rsync(873端口) 或者直接关闭防火墙。
关服务端selinux 和iptabs 防火墙
还有一种在同步过程中可能会提示没有权限 (将同步目录加上SvcwRsync全部权限即可,更简单的方法就是将SvcwRsync设为管理员即可)
需要给/etc/rsync.password 600权限
[root@backup backup]# ll -ld/etc/rsync.password
-rw-------. 1 root root 20 Sep 22 21:16/etc/rsync.password
12、rsync: failed to connect to 10.10.10.170: Connection refused (111)
rsync:failed to connect to 10.10.10.170: Connection refused (111)
rsyncerror: error in socket IO (code 10) at clientserver.c(124) [receiver=3.0.5]
启动服务:rsync --daemon--config=/etc/rsyncd.conf
13 、rsync:recv_generator: mkdir "/teacherclubBackup/rsync……" failed: No spaceleft on device (28)
*** Skipping any contents from this faileddirectory ***
磁盘空间满
14、rsync error: received SIGINT, SIGTERM, orSIGHUP (code 20) at rsync.c(544) [receiver=3.0.5]
rsyncerror: received SIGINT, SIGTERM, or SIGHUP (code 20) at rsync.c(544)[generator=3.0.5]
Ctrl+C或者大量文件
15、rsync: read error: Connection reset by peer (104)
rsync:read error: Connection reset by peer (104)
rsync error: error in rsync protocol datastream (code 12) at io.c(759) [receiver=3.0.5]
xnetid启动
查看rsync日志
rsync: unable to open configuration file"/etc/rsyncd.conf": No such file or directory
xnetid查找的配置文件位置默认是/etc下,根据具体情况创建软链接。例如:
ln -s /etc/rsyncd/rsyncd.conf /etc/rsyncd.conf
或者更改指定默认的配置文件路径,在/etc/xinetd.d/rsync配置文件中。
16、rsync:recv_generator: mkdir"nfs01_172.16.1.31" (in backup) failed:Permission denied (13)
sendingincremental file list
./
rsync:failed to set times on"." (in backup): Operation not permitted (1)
nfs01_172.16.1.31/
rsync:recv_generator: mkdir"nfs01_172.16.1.31" (in backup) failed:Permission denied (13)
***Skipping any contents fromthis failed directory ***
sent 106bytes received 15 bytes 80.67 bytes/sec
totalsize is 655 speedup is 5.41
rsyncerror: some files/attrs were not transferred (see previous errors) (code 23) atmain.c(1039) [sender=3.0.6]
错误原因:
1、服务端配置文件中指定的用户和模块指定的目录的属主属组不同
2、服务端模块指定的目录属组属组没有权限
解决方法:
将模块指定目录的属主属组修改为 配置文件中指定的 uid gid
[root@nfs01 ~]# chown rsync.rsync/backup 配置文件中指定的用户和组
17、skippingnon-regular file “vendor/bin/doctrine”
receivingincremental file list
skippingnon-regular file “vendor/bin/doctrine”
skippingnon-regular file “vendor/bin/doctrine.php”
sent1990 bytes received 489209 bytes 327466.00 bytes/sec total size is 182515746speedup is 371.57
原因:
source源文件有软链接。
解决方法:
修改为 rsync -va,其中 -a== -rlptgoD (no -H,-A,-X) 或者 rsync -rvltOD 也可以。
解决后:
receiving incremental file list
vendor/bin/doctrine ->../doctrine/orm/bin/doctrine
vendor/bin/doctrine.php ->../doctrine/orm/bin/doctrine.php
sent 1998 bytes received 489279 bytes327518.00 bytes/sec total size is 182515746 speedup is 371.51
18、@ERROR: module is read only
sendingincremental file list
ERROR:module is read only
rsyncerror: syntax or usage error (code 1) at main.c(866) [receiver=3.0.6]
rsync:read error: Connection reset by peer (104)
rsyncerror: error in rsync protocol data stream (code 12) at io.c(759)[sender=3.0.6]
原因:
source源服务器端权限设置read为only只读权限。
解决方法:
read only = false
19、password file must not be other-accessible
passwordfile must not be other-accessible
passwordfile must not be other-accessible
continuingwithout password file
Password:
原因:
这是因为rsyncd.pwd rsyncd.secrets的权限不对,应该设置为600。
解决方法:
chmod 600 rsyncd.pwd
20、rsync error: error starting client-server protocol
rsyncerror: error starting client-server protocol
rsyncerror: error starting client-server protocol (code 5) at main.c(1524)[Receiver=3.0.6]
原因:
/etc/rsyncd.conf配置文件内容有错误。请正确核对配置文件。
21、 rsync: chown “” failed: Invalid argument (22)
rsync:chown “” failed: Invalid argument (22)
原因:
权限无法复制。去掉同步权限的参数即可。(这种情况多见于Linux向Windows的时候)
22、@ERROR: daemon security issue — contactadmin
@ERROR:daemon security issue — contact admin rsync error: error starting client-serverprotocol (code 5) at main.c(1530) [sender=3.0.6]
原因:
同步的目录里面有权限不足的软连接文件,需要服务器端的/etc/rsyncd.conf打开use chroot = yes。
23、rsync: read error: Connection reset by peer (104)
rsync: read error: Connection reset by peer(104) rsync error: error in rsync protocol data stream (code 12) at io.c(794) [receiver=3.0.6]
解决:
很大可能是服务器端没有开启 rsync 服务,开启服务。
24、@ERROR: failed to openlock file
@ERROR:failed to open lock file rsync error: error starting client-server protocol(code 5) at main.c(1495) [receiver=3.0.6]
解决:
配置文件 rsync.conf 中添加lock file = rsyncd.lock 即可解决