码迷,mamicode.com
首页 > 其他好文 > 详细

rsync 常见故障排查及思路

时间:2017-04-14 21:05:37      阅读:691      评论:0      收藏:0      [点我收藏+]

标签:rsync

当我们在进行rsync操作时,会遇到各种各样的问题,那么下面就对通过客户端返回的错误信息进行分析

有很多新手,在客户端进行rsync推拉操作时,不清楚到底有没有出现错误,那么我们可以输入以下命令来进行查看,

 在命令行输入   echo $?    回车后如果显示0,则表示没有出现错误。恭喜你,操作成功。但不幸的是,也会由于操作等其他原因出现各种错误,下面就进入主题:

常见错误:

1、  No route to host (113)

[root@lnmp02 oldboy]# rsync -avz /tmp/ rsync_backup@192.168.0.204::backup --password-file=/etc/rsync.password 

rsync: failed to connect to 192.168.0.204: No route to host (113)

rsync error: error in socket IO (code 10) at clientserver.c(124) [sender=3.0.6]

[root@lnmp02 oldboy]# rsync -avz /tmp/ rsync_backup@192.168.0.204::backup --password-file=/etc/rsync.password 

sending incremental file list

./

yum.log

.ICE-unix/


sent 114 bytes  received 34 bytes  296.00 bytes/sec

total size is 0  speedup is 0.00

[root@lnmp02 oldboy]# echo $?

0

[root@lnmp02 oldboy]# 

错误原因:服务端和客户端iptables开启

解决方法:将服务端和客户端的iptables全部关闭

        /etc/init.d/iptables status     查看防火墙状态

        /etc/init.d/iptables stop       关闭防火墙,该命令最好连续执行两次


2、@ERROR: auth failed on module backup

[root@lamp01 oldboy]# ll /tmp/

total 4

-rw-------. 1 root root    0 Apr 11 20:31 yum.log

-rw-------. 1 root root 2247 Apr 13 04:29 yum_save_tx-2017-04-13-04-29ETHOfX.yumtx

[root@lamp01 oldboy]# rsync -avz /tmp/ rsync_back@192.168.0.204::backup --password-file=/etc/rsync.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@lamp01 oldboy]# rsync -avz /tmp/ rsync_backup@192.168.0.204::backup --password-file=/etc/rsync.password 

sending incremental file list

./

yum_save_tx-2017-04-13-04-29ETHOfX.yumtx

.ICE-unix/


sent 533 bytes  received 34 bytes  378.00 bytes/sec

total size is 2247  speedup is 3.96

错误原因:模块出现错误

解决方法:进入服务端,查看/etc/rsyncd.conf   查看auth user 和[]内的内容。例如正确答案应该是rsync -avz /tmp/ rsync_backup@192.168.0.204::backup --password-file=/etc/rsync.password 

3、The --password-file option may only be used when accessing an rsync daemon

错误原因:在服务端进行推拉

解决方法:应在客户端操作推拉命令

4、No such file or directory

错误原因:没有此文件或目录

解决方法:根据提示建立相应的文件或目录

5、ERROR: The remote path must start with a module name not a /

 rsync客户端执行rsync命令错误:

   客户端的错误现象:  

   [root@nfs01 tmp]# 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是错误的语法,应该为::backup(rsync模块)

6、@ERROR: Unknown module ‘backup‘

[root@nfs01 tmp]# rsync -avz /etc/hosts rsync_backup@172.16.1.41::backup

@ERROR: Unknown module ‘backup‘

rsync error: error starting client-server protocol (code 5) at main.c(1503) [sender=3.0.6]

 错误原因:模块写错了

  解决方法:1、 /etc/rsyncd.conf配置文件模块名称书写错误

            2、配置文件中网段限制不对

7、 invalid uid rsync

[root@nfs01 tmp]# 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服务对应rsync虚拟用户不存在了

解决方法:重新建立虚拟用户useradd rsync -s /sbin/nologin -M

8、rsync服务没有正确启动Connection refused (111)

 [root@oldboy-muban ~]#  rsync -avz /etc/hosts rsync_backup@172.16.1.41::backup

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服务没开启

[root@oldboy-muban ~]# rsync --daemon

[root@oldboy-muban ~]# ss -lntup |grep rsync

tcp    LISTEN     0      5                     :::873                  :::*      users:(("rsync",1434,5))

tcp    LISTEN     0      5                      *:873                   *:*      users:(("rsync",1434,4))

[root@oldboy-muban ~]# rsync -avz /etc/hosts rsync_backup@172.16.1.41::backup

Password:

sending incremental file list

hosts

 sent 196 bytes  received 27 bytes  49.56 bytes/sec

total size is 349  speedup is 1.57

9、--passwd-file=/etc/rsync.passwd: unknown option 没有正确输入password文件名

报错:--passwd-file=/etc/rsync.passwd: unknown option

错误案例  本地rsync.password 文件要保持一致缺少字母都会报错

echo "123456">>/etc/rsync.passwd

[root@nfs01 ~]# chmod 600 /etc/rsync.passwd

[root@nfs01 ~]# ll /etc/rsync.passwd

-rw------- 1 root root 7 Mar  9 13:47 /etc/rsync.passwd

[root@nfs01 ~]# rsync  -az -P /root/ rsync_backup@172.16.1.41::backup --passwd-file=/etc/rsync.passwd

rsync: --passwd-file=/etc/rsync.passwd: unknown option

rsync error: syntax or usage error (code 1) at main.c(1422) [client=3.0.6]

 正确做法:

[root@nfs01 ~]# echo "123456">>/etc/rsync.password

[root@nfs01 ~]# chmod 600 /etc/rsync.password

[root@nfs01 ~]# ll /etc/rsync.password

-rw------- 1 root root 7 Mar  9 13:49 /etc/rsync.password

rsync  -az -P /server/files/secure-20161219  rsync_backup@172.16.1.41::backup --password-file=/etc/rsync.password

sending incremental file list

secure-20161219

    51053780 100%   14.31MB/s    0:00:03 (xfer#1, to-check=0/1)

rsync: mkstemp ".secure-20161219.lcnuWA" (in backup) failed: Permission denied (13)

 

sent 2210982 bytes  received 27 bytes  491335.33 bytes/sec

total size is 51053780  speedup is 23.09

rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1039) [sender=3.0.6]

10、@ERROR: chroot failed 
rsync error: error starting client-server protocol (code 5) at main.c(1522) [receiver=3.0.3] 

原因: 
服务器端的目录不存在或无权限,创建目录并修正权限可解决问题。 

11、

rsync 常见故障排查及思路

标签:rsync

原文地址:http://congzz.blog.51cto.com/12548626/1916127

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!