|
在rsyncd.log里面或.err文件里面,大家可以用记事本打开查看。 注意windows下面我们需要给SvcwRsync用户,管理同步目录的所有权限,基本上这样就可以了 问题一: 9 d: O5 a1 o6 j ]
@ERROR: chroot failed
. A5 A" L. A3 R+ ~$ {' y7 R& Wrsync error: error starting client-server protocol (code 5) at main.c(1522) [receiver=3.0.3] : {, N9 K. M2 ^& u W4 S) V
" b9 L4 i- \6 M$ b9 Q
原因: & x+ K+ [8 x5 x8 g6 P# S4 v$ s
服务器端的目录不存在或无权限,创建目录并修正权限可解决问题。 % k& A2 z! n3 }: ]% O) ~
- l! \0 _" N4 K/ X" |问题二:
& ]3 L2 s7 X5 V( W@ERROR: auth failed on module tee
+ {) K+ u) s# y- v( w9 irsync error: error starting client-server protocol (code 5) at main.c(1522) [receiver=3.0.3]
5 `9 q7 F U6 G1 s+ W. w+ T6 @6 H% |- m! @% h
原因:
- E8 \" `9 J0 g: g+ t+ R" d3 Q服务器端该模块(tee)需要验证用户名密码,但客户端没有提供正确的用户名密码,认证失败。
7 `- v: H* \# F0 b提供正确的用户名密码解决此问题。 ; L$ z) d; _& ?5 b( H; f6 b" N
- x0 U" k: F. M" \8 h4 v, Y/ [; T问题三: 9 Y4 x% |; U" U9 x ~
@ERROR: Unknown module ‘tee_nonexists' ! S0 T1 S$ h$ j/ ]7 ~$ e* V9 n
rsync error: error starting client-server protocol (code 5) at main.c(1522) [receiver=3.0.3] ! G$ h* {* y2 W* N& { W
6 Q2 B8 d2 d4 Z5 p! `) q8 B原因: / {# d- ?9 H0 I- c
服务器不存在指定模块。提供正确的模块名或在服务器端修改成你要的模块以解决问题。
/ i* d" A, \! \! h5 x1 P) c0 i
/ K8 L, \4 P% r1 q R C) _1 c* ^3 r! k9 D% y" H" l
问题1: ! x/ P/ k* a: t: c
在client上遇到问题:
$ M0 x# U4 l9 A3 D' h/ ?: Wrsync -auzv --progress --password-file=/etc/rsync.pas root@192.168.133.128::backup /home/ 4 _" X' u. i4 |' |3 N
rsync: could not open password file "/etc/rsync.pas": No such file or directory (2)
O% S2 c9 V2 o0 t+ RPassword: 6 v* {4 d& N5 o# h6 n, L; ?; e
@ERROR: auth failed on module backup
! F- P7 w% i4 G3 P/ Vrsync error: error starting client-server protocol (code 5) at main.c(1506) [Receiver=3.0.7]
0 O& p6 P- w I, b: G$ E' { U5 J- ]遇到这个问题:client端没有设置/etc/rsync.pas这个文件,而在使用rsync命令的时候,加了这个参数-- / W$ g V. j0 o/ f& [: |
password-file=/etc/rsync.pas
" p# e8 V9 m8 B r" }3 P/ O7 _4 Z$ g9 K- n; m u5 h% X0 B0 I1 u
问题2:
" s" c& Y6 l" _rsync -auzv --progress --password-file=/etc/rsync.pas root@192.168.133.128::backup /home/ ) Z4 c/ ?1 w; K: L% b2 N( D
@ERROR: auth failed on module backup % j! r8 Z# w* w' H% M X
rsync error: error starting client-server protocol (code 5) at main.c(1506) [Receiver=3.0.7] : N- Y: D2 P3 B' n8 M
遇到这个问题:client端已经设置/etc/rsync.pas这个文件,里面也设置了密码111111,和服务器一致,但是 2 `: h1 t/ |' o1 c% l5 Q3 p0 r
服务器段设置有错误,服务器端应该设置/etc/rsync.pas ,里面内容root:111111 ,这里登陆名不可缺少 ; y6 Q8 Y0 q/ O. }+ Y
- \8 p u N( Z; |* m3 I
问题3:
4 W' }1 Q; D2 W- V3 \" t7 G- trsync -auzv --progress --password-file=/etc/rsync.pas root@192.168.133.128::backup /home/
0 e6 L; o. L1 B* T8 _: W@ERROR: chdir failed . L9 {! F. P7 k" S
rsync error: error starting client-server protocol (code 5) at main.c(1506) [Receiver=3.0.7] - Z2 R) e" Q% Z1 O6 j9 ^: b3 X
遇到这个问题,是因为服务器端的/home/backup 其中backup这个目录并没有设置,所以提示:chdir failed
8 O! h3 {. ?$ G( r' g2 J2 u; Q5 J% V& ^# g
问题4: / N8 |) s6 u- k: Z
rsync: write failed on "/home/backup2010/wensong": No space left on device (28)
7 }( C% M5 a6 G! @+ @7 t4 Irsync error: error in file IO (code 11) at receiver.c(302) [receiver=3.0.7] ' L8 \8 p* n9 L' }/ ~& t
rsync: connection unexpectedly closed (2721 bytes received so far) [generator] - i5 q+ s) F$ v2 s. P \
rsync error: error in rsync protocol data stream (code 12) at io.c(601) [generator=3.0.7]
' y& Q0 ~, K; @( T磁盘空间不够,所以无法操作。
Y6 F# P: G9 x2 V6 A可以通过df /home/backup2010 来查看可用空间和已用空间 " h; S, m' H' [
) g, [' l9 G$ ]7 J1 b; S( ?- u0 k% u问题5:网络收集问题
7 l! G# v" d: [# y# i1、权限问题 / i' a& |+ y. J8 G0 ^0 `& o
类似如下的提示:rsync: opendir "/kexue" (in dtsChannel) failed: Permission denied (13)注意查看同步的目录权限是否为755 - }% G& q J$ B# }* z( O- k
2、time out , p. Y; j6 v8 r; T8 O8 M; `- q( p, F
rsync: failed to connect to 203.100.192.66: Connection timed out (110)
) A7 u ~ H' Krsync error: error in socket IO (code 10) at clientserver.c(124) [receiver=3.0.5]
) ]6 Q* S& U3 |! n! Z$ V检查服务器的端口netstat –tunlp,远程telnet测试。
% W X& G4 f- e2 Q* G/ ?7 S可能因为客户端或者服务端的防火墙开启 导致无法通信,可以设置规则放行 rsync(873端口) 或者直接关闭防火墙。
0 n* ~( v0 s5 S- `1 S# C6 ^! t
$ G0 T. ]4 P8 R+ H/ }$ g& E" X# Z还有一种在同步过程中可能会提示没有权限 (将同步目录加上SvcwRsync全部权限即可,更简单的方法就是将SvcwRsync设为管理员即可)
+ s: R* h: O! f- r( b" @% r$ r
. J0 ]: L) v q* K4 Y, h `4 P( ?" G3 O
3、服务未启动
. I9 m+ _7 a# q6 }1 n& qrsync: failed to connect to 10.10.10.170: Connection refused (111) ) |. u, b8 W" c/ s1 G
rsync error: error in socket IO (code 10) at clientserver.c(124) [receiver=3.0.5]
$ a* L2 i/ ^- q7 |启动服务:rsync --daemon --config=/etc/rsyncd.conf 9 o3 v0 a9 z! X$ Y1 x3 b
4、磁盘空间满 0 |( G& B }! |( ?( x8 H2 K) P, v
rsync: recv_generator: mkdir "/teacherclubBackup/rsync……" failed: No space left on device (28)
% _4 Q2 Z2 K% z- t*** Skipping any contents from this failed directory *** E8 P* E# R a& N4 E& u
5、Ctrl+C或者大量文件 3 U. w, z" F* @: k
rsync error: received SIGINT, SIGTERM, or SIGHUP (code 20) at rsync.c(544) [receiver=3.0.5]
. o0 M6 N; q. W' `1 grsync error: received SIGINT, SIGTERM, or SIGHUP (code 20) at rsync.c(544) [generator=3.0.5] $ q9 {! k! W: S
说明:导致此问题多半是服务端服务没有被正常启动,到服务器上去查查服务是否有启动,然后查看下 /var/run/rsync.pid 文件是否存在,最干脆的方法是杀死已经启动了服务,然后再次启动服务或者让脚本加入系统启动服务级别然后shutdown -r now服务器- p" _" o+ I$ o1 o% K
2 L+ D. X+ O) l1 l7 w6、xnetid启动 4 S8 I0 h7 m; Q- T6 M
rsync: read error: Connection reset by peer (104) + d% C8 `+ @5 k! b* m" C i3 |
rsync error: error in rsync protocol data stream (code 12) at io.c(759) [receiver=3.0.5] 8 ]# H3 |8 W. X- ]1 \
查看rsync日志 , O; @& h/ a0 H" A- Q
rsync: unable to open configuration file "/etc/rsyncd.conf": No such file or directory & O; t/ v$ B- W
xnetid查找的配置文件位置默认是/etc下,根据具体情况创建软链接。例如:
* ~+ @0 Z+ L# U! x! M nln -s /etc/rsyncd/rsyncd.conf /etc/rsyncd.conf 9 v4 c9 L" p) d8 X$ }
或者更改指定默认的配置文件路径,在/etc/xinetd.d/rsync配置文件中。 + n% J/ L( e5 J% d4 x
Rsync configure:3 d8 } H* W+ O! F
配置一:
a" [8 j; r+ X0 o( x( D" Hignore errors
' j" q3 H+ G: O/ O8 r6 F) H _说明:这个选项最好加上,否则再很多crontab的时候往往发生错误你也未可知,因为你不可能天天去看每时每刻去看log,不加上这个出现错误的几率相对会很高,因为任何大点的项目和系统,磁盘IO都是一个瓶颈
" ?; D! x: _; x. G5 D9 `2 F* u) p" @7 O1 k0 h0 R
Rsync error:
) S! d5 p; w. x% X" z( |1 S错误一: ( ], ~" y1 z1 v0 i7 b7 Q
@ERROR: auth failed on module xxxxx / i5 Q/ ~8 |" |$ a3 o7 g% ~* p
rsync: connection unexpectedly closed (90 bytes read so far)
' `" N6 B- P: M2 X4 Vrsync error: error in rsync protocol data stream (code 12) at io.c(150) / F# F2 S! w9 {; D/ t$ X
说明:这是因为密码设置错了,无法登入成功,检查一下rsync.pwd,看客服是否匹配。还有服务器端没启动rsync 服务也会出现这种情况。 错误二: 1 x' c% O/ p! c
password file must not be other-accessible
0 o6 j% I+ G* G/ @9 ~2 D% Ycontinuing without password file
) ?6 I: H- o" F# P/ v' aPassword: / ~4 V: ~. b( e' l
说明:这是因为rsyncd.pwd rsyncd.sec的权限不对,应该设置为600。如:chmod 600 rsyncd.pwd 错误三: 9 Z7 Q" @& v4 @" r* {+ w" i0 x
@ERROR: chroot failed 8 r& I G$ r9 J9 ^" d/ e; m/ M( a
rsync: connection unexpectedly closed (75 bytes read so far)
( t# d' q& X+ k* a: G8 zrsync error: error in rsync protocol data stream (code 12) at io.c(150)
; R9 S5 ^4 d% i: O说明:这是因为你在 rsync.conf 中设置的 path 路径不存在,要新建目录才能开启同步 错误四:
+ J; {* X2 T$ d3 w5 j: I% Orsync: failed to connect to 218.107.243.2: No route to host (113) 7 H& x0 e- y0 c3 k/ Q2 A( F& P
rsync error: error in socket IO (code 10) at clientserver.c(104) [receiver=2.6.9] ! \3 c8 }2 N. `0 e1 W" t+ H5 V, t
说明:防火墙问题导致,这个最好先彻底关闭防火墙,排错的基本法就是这样,无论是S还是C,还有ignore errors选项问题也会导致, N, L, R! _/ y8 J4 g( c
' \( ~4 _. D& o1 x9 ?8 U8 U错误五:
b5 M! m; e) N3 m0 ^9 n@ERROR: access denied to www from unknown (192.168.1.123)
* g7 \+ I! }! Z% @rsync: connection unexpectedly closed (0 bytes received so far) [receiver]
! |/ k: g' X; H8 ~$ _rsync error: error in rsync protocol data stream (code 12) at io.c(359) S4 r% q* p t4 a0 A( K% v$ X
说明:此问题很明显,是配置选项host allow的问题,初学者喜欢一个允许段做成一个配置,然后模块又是同一个,致使导致 错误六:* B! a, f& x, @1 |+ o9 c* o# y
rsync error: received SIGINT, SIGTERM, or SIGHUP (code 20) at rsync.c(244) [generator=2.6.9]
6 |$ _5 {6 j) G7 ?) Rrsync error: received SIGUSR1 (code 19) at main.c(1182) [receiver=2.6.9]
7 j6 R" _8 M' m8 H4 A, U说明:导致此问题多半是服务端服务没有被正常启动,到服务器上去查查服务是否有启动,然后查看下 /var/run/rsync.pid 文件是否存在,最干脆的方法是杀死已经启动了服务,然后再次启动服务或者让脚本加入系统启动服务级别然后shutdown -r now服务器 错误七:
4 ~; s0 w: b$ s" mrsync: read error: Connection reset by peer (104)
; t# w' X2 R& [7 |0 |; H9 e2 w" Zrsync error: error in rsync protocol data stream (code 12) at io.c(604) [sender=2.6.9]+ }' e5 L8 K% V7 t5 U
说明:原数据目录里没有数据存在
6 j3 {& p' i6 `7 F6 c3 B' h @ rsync 错误与解决方法整理补充篇 由于我们经常使用rsync进行服务器文件的同步工作,但在配置过程中,会出现很多问题,下面的错误基本上都是通过客户端返回的错误进行分析。 另外查找错误过程中也学到了一个查看错误的方法-查看系统日志,我们操作的每步都会在日志上有说明,有时候报错看不懂,日志上都写的清清楚楚。 命令:cat /var/log/messages 问题一: @ERROR: auth failed on module bachup' q) w; o( v, ~* \9 j# q, m
rsync error: error starting client-server protocol (code 5) at main.c(1522) [receiver=3.0.3] 原因:服务器端该模块(backup)需要验证用户名密码,但客户端没有提供正确的用户名密码,认证失败。 提供正确的用户名密码解决此问题。
( M: |3 j* x1 R3 N7 P# F0 h4 O. B这个问题比较蠢,如果可能你和我一样明明在模块里写了密码文件,怎么都不通,这个时候我劝你先检查一下所写模块中是不是和下图一样。比如,某处多了个s。2 a s6 V5 a% S. q3 X
微信图片_20210306223602.p ...
问题二:110错误 -time out rsync: failed to connect to 203.100.192.66: Connection timed out (110) " ^6 j6 \1 c1 G* A9 R2 c# _, {
rsync error: error in socket IO (code 10) at clientserver.c(124) [receiver=3.0.5] 原因: 检查服务器的端口netstat –tunlp,远程telnet测试。 可能因为客户端或者服务端的防火墙开启 导致无法通信,可以设置规则放行 rsync(873端口) 或者直接关闭防火墙。 1 B% v( g, f" A; Z' N! [* o) H
在这里博主是重启过服务器,然后就报110了,直接开启rsync服务就行。 命令:service rsyncd start 问题三:113错误 -防火墙6 d: Q! {. A( R8 x' p$ s
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]
8 {5 |6 @5 n- G/ f+ I原因:
8 O: M# l# p2 A& ~$ s1 b防火墙问题导致,这个很简单,关闭防火墙就可以。不过博主还是被困在这里几个小时,因为linux防火墙分两种: -iptable和-firewall
& w4 Z4 [3 m! w* K认识到这个问题首先查看系统的防火墙种类,查看防火墙状态即可; i ], Q$ g& \7 v
service iptable status
; r& V& {% w, }6 f" i5 t" o1 r% Afirewall-cmd --state 确定防火墙种类后再按对应方法将防火墙关闭即可。 问题四:1516错误 @ERROR: auth failed on module backup2 ]7 p1 `5 I# @% N5 ~# A9 r
rsync error: error starting client-server protocol (code 5) at main.c(1516) [Receiver=3.0.9]7 Z k; `5 W/ A7 k/ J( S

0 ?/ p4 n7 M+ j0 c$ S" r1 Q% E2 Q e& {4 P
' x+ \% {. o u3 I, j' a+ ]& J微信图片_20210306223651.p .... s; W) G% [! P/ ~
- u3 f. h6 K# _4 ~0 J$ G* Q, ~% o" f) Y& C4 i
解决:这个问题错误差别很大,可查看系统日志查看错误,再搜索解决方法。 注意:一般这种情况都建立在可以连通的基础。去服务端查看系统日志,可以查看相关错误。 命令:cat /var/log/massages cat /var/log/rsyncd.log |