易陆发现互联网技术论坛

 找回密码
 开始注册
查看: 2559|回复: 2
收起左侧

使用rsync 常见错误与解决方法整理

[复制链接]
发表于 2021-3-6 22:37:20 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?开始注册

x

在rsyncd.log里面或.err文件里面,大家可以用记事本打开查看。

注意windows下面我们需要给SvcwRsync用户,管理同步目录的所有权限,基本上这样就可以了

问题一: 3 _8 t' Y* b2 s9 e* y0 U7 R- p
@ERROR: chroot failed ; e3 c1 @8 P  i5 V# s3 Z/ {0 V, U
rsync error: error starting client-server protocol (code 5) at main.c(1522) [receiver=3.0.3] % U  T& g1 Y; {
/ }* [$ Z8 h: `6 G4 X! z* g$ i# F/ D5 \
原因: ' U" T4 B3 \1 z. ~; O: t  n$ f! u
服务器端的目录不存在或无权限,创建目录并修正权限可解决问题。 , F, w* }* D- d& k& A1 w7 K# ~
  t* N- U% @8 W) ], a/ }: m. M
问题二: 0 [/ u/ M$ J2 N8 p
@ERROR: auth failed on module tee - H2 \. ~, Z3 F6 \
rsync error: error starting client-server protocol (code 5) at main.c(1522) [receiver=3.0.3] 5 w5 d, X3 g6 W; f- ~% D

0 |8 j% {/ z6 Y0 S原因: 9 I( y2 H% w* O0 M
服务器端该模块(tee)需要验证用户名密码,但客户端没有提供正确的用户名密码,认证失败。 0 d) D# C5 S# e3 j
提供正确的用户名密码解决此问题。
$ X% D5 v4 _: ?, J1 k/ A/ Q) p! X. Y% J& }1 I2 X
问题三: - y0 x3 N! q, S+ h; p
@ERROR: Unknown module ‘tee_nonexists' ; N2 {& i! `: \; w$ L
rsync error: error starting client-server protocol (code 5) at main.c(1522) [receiver=3.0.3] 4 B( [! F1 J& @; d3 p  J" A4 L$ K- H
& J7 V2 T* Z! P6 s* ^! B5 Y
原因:
8 r! d6 j, x' {服务器不存在指定模块。提供正确的模块名或在服务器端修改成你要的模块以解决问题。 / Q2 k3 T( _5 H1 L+ J! `8 M
$ @* Q0 B) w, ?3 b3 G( o4 x2 P
" M9 k% b1 `5 x8 E) L0 H
问题1:
6 T" y/ c$ r9 O% k! b, S在client上遇到问题:
# H- Z/ |% w. p2 Y' i7 g3 mrsync -auzv --progress --password-file=/etc/rsync.pas root@192.168.133.128::backup /home/
. T. x0 o* h  x$ k# Rrsync: could not open password file "/etc/rsync.pas": No such file or directory (2) ) L+ e0 F3 I6 {; q, ~; z
Password:
, T4 [- ]( r/ b( R- ?2 u! @% |@ERROR: auth failed on module backup
+ J1 Q; u2 V. T' wrsync error: error starting client-server protocol (code 5) at main.c(1506) [Receiver=3.0.7]
- a: o$ ?7 w! e" z1 c& I  D- n遇到这个问题:client端没有设置/etc/rsync.pas这个文件,而在使用rsync命令的时候,加了这个参数-- ( m" ]$ r3 r% F& R9 p+ x
password-file=/etc/rsync.pas
. {* t/ x! e7 s$ _- r; L
) Y! f# L1 f. l) V, H# Z4 S  P问题2: " A. w. g% E& u+ I
rsync -auzv --progress --password-file=/etc/rsync.pas root@192.168.133.128::backup /home/ 2 @$ u$ |. e. i6 n
@ERROR: auth failed on module backup 4 O; L* r7 A! v1 k2 w
rsync error: error starting client-server protocol (code 5) at main.c(1506) [Receiver=3.0.7] 9 {4 r5 Y* q# P1 v8 Z, w
遇到这个问题:client端已经设置/etc/rsync.pas这个文件,里面也设置了密码111111,和服务器一致,但是
$ A9 S8 r9 P4 N8 o* A9 }服务器段设置有错误,服务器端应该设置/etc/rsync.pas ,里面内容root:111111 ,这里登陆名不可缺少 1 j8 J) t/ t0 f$ d1 W3 Z
( B; \! P5 ^0 {4 a
问题3:
& L- A% x: I4 |5 J  ~5 w/ Prsync -auzv --progress --password-file=/etc/rsync.pas root@192.168.133.128::backup /home/
8 M  F4 ?: N( u@ERROR: chdir failed - X9 [6 M# M& K
rsync error: error starting client-server protocol (code 5) at main.c(1506) [Receiver=3.0.7] + _& e9 K5 d3 y( B. |' A6 T! }
遇到这个问题,是因为服务器端的/home/backup 其中backup这个目录并没有设置,所以提示:chdir failed
5 r: f2 B. ~, I1 b" i9 m+ h+ o5 `
- J! D5 A2 d5 O2 W问题4: # C, C8 h! A5 J# d* |# q0 s
rsync: write failed on "/home/backup2010/wensong": No space left on device (28)
7 Z! D4 \7 V) ~rsync error: error in file IO (code 11) at receiver.c(302) [receiver=3.0.7]
* w6 _3 I$ V$ o: f8 m# [$ B. |rsync: connection unexpectedly closed (2721 bytes received so far) [generator]
/ z, a. h) l( R! v' c4 L2 arsync error: error in rsync protocol data stream (code 12) at io.c(601) [generator=3.0.7] 6 F7 }& ?' S3 |8 P- ]  q" [, Y
磁盘空间不够,所以无法操作。
/ P/ o- M) a+ B% ^, \6 h可以通过df /home/backup2010 来查看可用空间和已用空间
% r% ?' b! j$ v% b" p+ x' u$ N' N7 _5 [  C4 s6 I* ~
问题5:网络收集问题
# M# E2 O' c+ \" m  p9 c7 p4 W) g1、权限问题 ) g7 u7 @! ?9 T6 ]3 d3 Z
类似如下的提示:rsync: opendir "/kexue" (in dtsChannel) failed: Permission denied (13)注意查看同步的目录权限是否为755
; v" z' o/ X# D, Z$ F2、time out ( X) b/ Q1 v' g$ h7 k; v; i5 e
rsync: failed to connect to 203.100.192.66: Connection timed out (110)
7 A$ f' s0 p1 |1 u' p- frsync error: error in socket IO (code 10) at clientserver.c(124) [receiver=3.0.5] # o+ e! x: O6 f! H
检查服务器的端口netstat –tunlp,远程telnet测试。 ' @7 ^9 e: |6 |9 c6 b& O
可能因为客户端或者服务端的防火墙开启 导致无法通信,可以设置规则放行 rsync(873端口) 或者直接关闭防火墙。 3 r: n7 t/ C3 v" s

+ C6 ~" i* |% ?8 j2 Z: k% V还有一种在同步过程中可能会提示没有权限 (将同步目录加上SvcwRsync全部权限即可,更简单的方法就是将SvcwRsync设为管理员即可)" V5 a" K- E1 }) V  V
* c" S5 y1 }) `$ O  T. }/ F1 i7 Q
  _& a/ z; _9 ?0 e: N8 a' z
3、服务未启动 ( i5 u: r  y; x5 b7 Z+ M$ p' W/ m$ }
rsync: failed to connect to 10.10.10.170: Connection refused (111) & F! o( k7 q/ Y- A/ O* K1 m, \
rsync error: error in socket IO (code 10) at clientserver.c(124) [receiver=3.0.5]
* N: N; \4 t+ H启动服务:rsync --daemon --config=/etc/rsyncd.conf
& `" ~7 ]' k3 Y' L2 B1 U9 ?0 o; }4、磁盘空间满
, y3 L' h; V' t% Mrsync: recv_generator: mkdir "/teacherclubBackup/rsync……" failed: No space left on device (28)
% D& E0 u2 N/ H2 o8 f% Z*** Skipping any contents from this failed directory ***
" m' N1 j# W/ `- ]/ |5、Ctrl+C或者大量文件 $ c; \2 x. g- g
rsync error: received SIGINT, SIGTERM, or SIGHUP (code 20) at rsync.c(544) [receiver=3.0.5]   ]5 v. h# g+ d0 P$ d
rsync error: received SIGINT, SIGTERM, or SIGHUP (code 20) at rsync.c(544) [generator=3.0.5] - j8 H2 E0 P3 }$ Y+ m- N. v
说明:导致此问题多半是服务端服务没有被正常启动,到服务器上去查查服务是否有启动,然后查看下 /var/run/rsync.pid 文件是否存在,最干脆的方法是杀死已经启动了服务,然后再次启动服务或者让脚本加入系统启动服务级别然后shutdown -r now服务器1 w6 w/ R; Z3 K  r2 K/ ~- \

8 H* Y, M$ K% K- L" N& |6、xnetid启动 . f" m6 p% Y$ c4 {' Y" w' H0 Z
rsync: read error: Connection reset by peer (104) % h6 S- c  M7 ^2 m: P4 Y; {" {
rsync error: error in rsync protocol data stream (code 12) at io.c(759) [receiver=3.0.5] 7 d0 Q9 p/ V* W1 h
查看rsync日志 " {' {6 m: b9 f. b
rsync: unable to open configuration file "/etc/rsyncd.conf": No such file or directory ) e) a. J7 |% o; t
xnetid查找的配置文件位置默认是/etc下,根据具体情况创建软链接。例如: % |% G# @9 S5 a; Q+ k4 V
ln -s /etc/rsyncd/rsyncd.conf /etc/rsyncd.conf
) [+ G' d' c( K3 E或者更改指定默认的配置文件路径,在/etc/xinetd.d/rsync配置文件中。
/ o0 p  k# R$ r  M& _! d

Rsync configure:' a. w  h  E" b$ _0 @
配置一:
. J. }: B; V3 v# M" f- eignore errors! u. l+ v5 V3 N# G; Y' Y: z
说明:这个选项最好加上,否则再很多crontab的时候往往发生错误你也未可知,因为你不可能天天去看每时每刻去看log,不加上这个出现错误的几率相对会很高,因为任何大点的项目和系统,磁盘IO都是一个瓶颈, [- ]8 R( @9 Q8 P0 b2 T' a3 Z

' A1 p  R; [; JRsync error: 1 y# e$ C# `# `3 _! D% ^& K
错误一: - H4 d% b  s5 g9 f$ h7 I  ?
@ERROR: auth failed on module xxxxx $ ]8 S( {2 C, p: P' O' Y, @
rsync: connection unexpectedly closed (90 bytes read so far) 3 |. o( k+ x, P1 i8 D1 K
rsync error: error in rsync protocol data stream (code 12) at io.c(150)
4 S5 u* Q9 V% A5 J$ H0 E说明:这是因为密码设置错了,无法登入成功,检查一下rsync.pwd,看客服是否匹配。还有服务器端没启动rsync 服务也会出现这种情况。

错误二: $ Z  \2 x* @& @1 o4 \0 c
password file must not be other-accessible
8 y7 j+ f2 ]+ }) @7 i! Qcontinuing without password file " }  W7 u; y: J6 v# b% N1 e
Password:   Y# V6 q" a  ^+ Q
说明:这是因为rsyncd.pwd rsyncd.sec的权限不对,应该设置为600。如:chmod 600 rsyncd.pwd

错误三: 0 t9 K2 v) T2 r4 F2 I
@ERROR: chroot failed
9 W* X$ e: y0 P. g; e6 Ersync: connection unexpectedly closed (75 bytes read so far) - n7 J& d. ?7 j& U
rsync error: error in rsync protocol data stream (code 12) at io.c(150)
" l2 D" j% O1 t0 ?说明:这是因为你在 rsync.conf 中设置的 path 路径不存在,要新建目录才能开启同步

错误四: $ ^4 Y0 j0 J; A2 ]4 G* J$ Y
rsync: failed to connect to 218.107.243.2: No route to host (113)
) F* L! w/ K! q9 a* qrsync error: error in socket IO (code 10) at clientserver.c(104) [receiver=2.6.9] 6 L) T& X$ ]+ H5 V4 a, n7 [
说明:防火墙问题导致,这个最好先彻底关闭防火墙,排错的基本法就是这样,无论是S还是C,还有ignore errors选项问题也会导致
% k  E; }% X( u4 a1 V0 t' P
6 t* Q, F) P( o% i, ~; E7 ^错误五:
# L5 ^+ I# G5 I. @. D" i4 t@ERROR: access denied to www from unknown (192.168.1.123)
/ Z! V5 m1 e& G: s$ E/ @  T8 ?rsync: connection unexpectedly closed (0 bytes received so far) [receiver]9 Z2 z0 r# {+ d* E2 @2 t
rsync error: error in rsync protocol data stream (code 12) at io.c(359)* `' J: ?' r9 i
说明:此问题很明显,是配置选项host allow的问题,初学者喜欢一个允许段做成一个配置,然后模块又是同一个,致使导致

错误六:0 Q% M# W- b9 f; p0 K
rsync error: received SIGINT, SIGTERM, or SIGHUP (code 20) at rsync.c(244) [generator=2.6.9]( A- A$ k9 W$ m7 u* E. {) X# _' N$ c
rsync error: received SIGUSR1 (code 19) at main.c(1182) [receiver=2.6.9]
8 d$ q, J) h( `9 O3 A' S. l5 Q- N, O说明:导致此问题多半是服务端服务没有被正常启动,到服务器上去查查服务是否有启动,然后查看下 /var/run/rsync.pid 文件是否存在,最干脆的方法是杀死已经启动了服务,然后再次启动服务或者让脚本加入系统启动服务级别然后shutdown -r now服务器

错误七:
* E9 b, Q; }1 D- `5 Nrsync: read error: Connection reset by peer (104)
4 w* p! [4 C' X5 Nrsync error: error in rsync protocol data stream (code 12) at io.c(604) [sender=2.6.9]0 X( S  [" \8 l4 s, i
说明:原数据目录里没有数据存在
: Q8 R! @' e' u) O/ e

rsync 错误与解决方法整理补充篇

由于我们经常使用rsync进行服务器文件的同步工作,但在配置过程中,会出现很多问题,下面的错误基本上都是通过客户端返回的错误进行分析。

      另外查找错误过程中也学到了一个查看错误的方法-查看系统日志,我们操作的每步都会在日志上有说明,有时候报错看不懂,日志上都写的清清楚楚。

      命令:cat /var/log/messages

问题一:

@ERROR: auth failed on module bachup( K9 U! t# L: }0 ~4 C9 g
rsync error: error starting client-server protocol (code 5) at main.c(1522) [receiver=3.0.3]

原因:服务器端该模块(backup)需要验证用户名密码,但客户端没有提供正确的用户名密码,认证失败。  提供正确的用户名密码解决此问题。
9 |: e2 |3 T$ M" z这个问题比较蠢,如果可能你和我一样明明在模块里写了密码文件,怎么都不通,这个时候我劝你先检查一下所写模块中是不是和下图一样。比如,某处多了个s。5 Y) S4 z/ I( s" C" B+ M9 C

' D1 `. y$ N9 V) z* c! A
                               
登录/注册后可看大图
微信图片_20210306223602.p ...

问题二:110错误 -time out

rsync: failed to connect to 203.100.192.66: Connection timed out (110)
7 y" t5 L$ k# a, ?- n0 X- c! ]) _rsync error: error in socket IO (code 10) at clientserver.c(124) [receiver=3.0.5]

原因:

检查服务器的端口netstat –tunlp,远程telnet测试。 可能因为客户端或者服务端的防火墙开启 导致无法通信,可以设置规则放行 rsync(873端口) 或者直接关闭防火墙。 . ^; l8 H% D3 A2 m& z
在这里博主是重启过服务器,然后就报110了,直接开启rsync服务就行。

命令:service rsyncd start

问题三:113错误 -防火墙$ M  q3 t- K' r* x( e
rsync: failed to connect to 218.107.243.2: No route to host (113) rsync error: error in socket IO (code 10) at clientserver.c(104) [receiver=2.6.9]
9 s" D4 J' Q" i! m3 ]3 P1 B" K# I原因:7 k. w3 s- V! J* a' b+ s
防火墙问题导致,这个很简单,关闭防火墙就可以。不过博主还是被困在这里几个小时,因为linux防火墙分两种:

-iptable和-firewall, R! b5 n( i$ n! ]% I! e# ~5 j
认识到这个问题首先查看系统的防火墙种类,查看防火墙状态即可
( n5 N' S) U! ]service iptable status
9 M3 m8 G9 v# M( Q( I7 i+ k# kfirewall-cmd --state

确定防火墙种类后再按对应方法将防火墙关闭即可。

问题四:1516错误

@ERROR: auth failed on module backup. o8 B) Q4 V% |4 h$ a5 a2 P
rsync error: error starting client-server protocol (code 5) at main.c(1516) [Receiver=3.0.9]9 f& Y. D% }. H% R' G

* a5 ^- Y, b3 d$ V
                               
登录/注册后可看大图

. z1 V' Q, p) o% l; }. H( k4 ]/ r
1 v6 Q; a' K4 r8 w! {" U
# [8 Y( |, x6 f! O微信图片_20210306223651.p ...& N7 p+ o- v$ @- o5 g5 ~

2 O# `/ S, f8 `( |! J4 e' f. i

解决:这个问题错误差别很大,可查看系统日志查看错误,再搜索解决方法。

注意:一般这种情况都建立在可以连通的基础。去服务端查看系统日志,可以查看相关错误。

命令:cat /var/log/massages

cat /var/log/rsyncd.log

微信图片_20210306223651.png
微信图片_20210306223602.png
 楼主| 发表于 2021-3-8 09:45:25 | 显示全部楼层
使用rsync同步数据命令如下(不需要密码格式):
& v. m: t3 b: F! e; orsync -avrt rsync://rsync:mirrors.org/cento /data/html/cent
 楼主| 发表于 2021-3-12 21:35:31 | 显示全部楼层
rsync -avrt --bwlimit=20000 rsync://rsync.mirrors.ustc.edu.cn/centos/8.3.2011/BaseOS/x86_64/os/  /usr/src/CentOS8/
您需要登录后才可以回帖 登录 | 开始注册

本版积分规则

关闭

站长推荐上一条 /4 下一条

北京云银创陇科技有限公司以云计算运维,代码开发

QQ|返回首页|Archiver|小黑屋|易陆发现技术论坛 ( 蜀ICP备2026014127号-1 )点击这里给我发消息

GMT+8, 2026-4-8 23:55 , Processed in 0.090994 second(s), 26 queries .

Powered by Discuz! X3.4 Licensed

© 2012-2025 Discuz! Team.

快速回复 返回顶部 返回列表