|
在rsyncd.log里面或.err文件里面,大家可以用记事本打开查看。 注意windows下面我们需要给SvcwRsync用户,管理同步目录的所有权限,基本上这样就可以了 问题一:
4 v' Y" \* `' P: F) v@ERROR: chroot failed 5 U9 J( y ~0 _& D/ y ]* D
rsync error: error starting client-server protocol (code 5) at main.c(1522) [receiver=3.0.3] + f" e4 X$ I! p- E( I9 Z& E
- T: P F; p$ ]- `& x5 T
原因: ' Q! x4 b$ I' l! |8 M. B
服务器端的目录不存在或无权限,创建目录并修正权限可解决问题。 ' G. |5 c4 n/ y5 C7 u
4 L5 {& u( n$ m" Z问题二: " z! |2 K+ m! s6 L7 T5 f% Z
@ERROR: auth failed on module tee : j: ~8 I8 D0 M; Q9 [3 p; J
rsync error: error starting client-server protocol (code 5) at main.c(1522) [receiver=3.0.3] . l) v: h) s0 l% `- u
4 J% t* f7 Y; O0 W* L: U9 w
原因:
( s3 d5 W7 v1 ~& ?5 b服务器端该模块(tee)需要验证用户名密码,但客户端没有提供正确的用户名密码,认证失败。
" p: T9 M# J" Z5 l, X7 {( ]: p提供正确的用户名密码解决此问题。 7 t3 z8 e0 k* N# a: o
" g; `, ?- w$ e' L, H
问题三: ) a) [3 k, `+ y
@ERROR: Unknown module ‘tee_nonexists' 2 j8 f' H* r% J( w* \7 C3 S
rsync error: error starting client-server protocol (code 5) at main.c(1522) [receiver=3.0.3]
p% K& j0 T: f, x
: B5 D* t7 G4 d原因: ' H, n2 D e' s( |& U
服务器不存在指定模块。提供正确的模块名或在服务器端修改成你要的模块以解决问题。
4 G' a g1 s8 `$ l$ i* W! W' y
5 B, g- _% ^; `2 ^+ Z8 ?" a8 U/ R
: t9 h' P- i- U5 a. Z- {问题1: 2 j% ^% w7 @$ `- S, |8 i
在client上遇到问题: $ h. z& D# f& \7 g; b7 e
rsync -auzv --progress --password-file=/etc/rsync.pas root@192.168.133.128::backup /home/ 1 w7 D: H7 u+ j4 O, W4 H
rsync: could not open password file "/etc/rsync.pas": No such file or directory (2) , e" J! U( {8 |: X9 {% h
Password:
$ t# a; ~" H# j0 Q: m% `1 [6 ~@ERROR: auth failed on module backup
. d2 G w1 v. b0 l/ s0 X& B# F8 qrsync error: error starting client-server protocol (code 5) at main.c(1506) [Receiver=3.0.7] # c9 ` x1 x+ ?( n; J
遇到这个问题:client端没有设置/etc/rsync.pas这个文件,而在使用rsync命令的时候,加了这个参数--
. G+ r$ F" \7 b) J1 |$ t8 qpassword-file=/etc/rsync.pas - E) c( ~" F# l1 x! N
& A7 C3 ?& |! J* L4 Q$ t
问题2: & b1 B7 i& o# ]# [2 ~
rsync -auzv --progress --password-file=/etc/rsync.pas root@192.168.133.128::backup /home/
; C/ R- L4 z: b7 s/ J' ^@ERROR: auth failed on module backup
8 w+ w7 m+ |0 \0 N/ M! Rrsync error: error starting client-server protocol (code 5) at main.c(1506) [Receiver=3.0.7] + o5 U& @# \- W/ G9 \
遇到这个问题:client端已经设置/etc/rsync.pas这个文件,里面也设置了密码111111,和服务器一致,但是
" S) l% R: y, ?2 b& N8 i8 S+ D服务器段设置有错误,服务器端应该设置/etc/rsync.pas ,里面内容root:111111 ,这里登陆名不可缺少 " ~" A. x8 y2 T8 r
3 }9 q. {+ F! P, ?1 d
问题3:
( B0 v) |4 G, }' Orsync -auzv --progress --password-file=/etc/rsync.pas root@192.168.133.128::backup /home/ 0 l. @, h e; f% V, @9 G7 ?
@ERROR: chdir failed
( a% G, K* ^% x7 I v& t' Krsync error: error starting client-server protocol (code 5) at main.c(1506) [Receiver=3.0.7]
5 ~) V2 c/ k) P8 t$ b遇到这个问题,是因为服务器端的/home/backup 其中backup这个目录并没有设置,所以提示:chdir failed ( ^" H) b2 m$ r* \
D2 p' u# B* w" o* X5 c! m* J
问题4: 1 M7 m9 r8 a6 @* I, @& N3 v
rsync: write failed on "/home/backup2010/wensong": No space left on device (28)
* ` S4 m# }+ R, P- @rsync error: error in file IO (code 11) at receiver.c(302) [receiver=3.0.7]
! K4 B; ^) L6 x3 Drsync: connection unexpectedly closed (2721 bytes received so far) [generator]
+ ?' l5 C" D; b* a) o/ brsync error: error in rsync protocol data stream (code 12) at io.c(601) [generator=3.0.7] " h& l5 w# ?4 C" x( Z8 Z- k
磁盘空间不够,所以无法操作。 7 M9 P. Z' T( t# T3 u3 {
可以通过df /home/backup2010 来查看可用空间和已用空间 3 g& T3 j D- s( [2 d& ^
" U* x: Z W2 [( j
问题5:网络收集问题
0 ?) P! B- @3 B1、权限问题
- a3 Y1 J! l' w8 c类似如下的提示:rsync: opendir "/kexue" (in dtsChannel) failed: Permission denied (13)注意查看同步的目录权限是否为755
- B$ `7 m0 B+ K- R3 g3 y) @+ s2、time out # ~+ Q; j8 w9 x0 P& C+ [( U
rsync: failed to connect to 203.100.192.66: Connection timed out (110)
% w& z2 a/ Q& irsync error: error in socket IO (code 10) at clientserver.c(124) [receiver=3.0.5] 0 x' {$ g3 u9 M: }& N- r
检查服务器的端口netstat –tunlp,远程telnet测试。 7 R$ q8 s( Q- X0 r4 v7 q' V8 \0 y
可能因为客户端或者服务端的防火墙开启 导致无法通信,可以设置规则放行 rsync(873端口) 或者直接关闭防火墙。
3 G6 H k( K0 C& Q
& P8 g7 E# E& o" G还有一种在同步过程中可能会提示没有权限 (将同步目录加上SvcwRsync全部权限即可,更简单的方法就是将SvcwRsync设为管理员即可)
$ K q# U! ~$ D! y k
$ l' l- I5 M1 ^. U4 F+ d I5 F8 [6 z; _2 M5 g* [5 P$ y
3、服务未启动 : B$ ~+ C8 a& \' y
rsync: failed to connect to 10.10.10.170: Connection refused (111) 6 {9 @& k7 Q3 a1 S
rsync error: error in socket IO (code 10) at clientserver.c(124) [receiver=3.0.5] * x' A2 Z- V( X$ d
启动服务:rsync --daemon --config=/etc/rsyncd.conf
" G2 L7 \. F' {* t/ k4、磁盘空间满
0 _5 t6 U4 G8 ]8 grsync: recv_generator: mkdir "/teacherclubBackup/rsync……" failed: No space left on device (28)
( Q& \( _9 p1 p; ?0 }1 r$ G*** Skipping any contents from this failed directory *** & b" T9 _; o$ j! o
5、Ctrl+C或者大量文件 2 u# L9 K" @! i$ H7 [7 B7 ^
rsync error: received SIGINT, SIGTERM, or SIGHUP (code 20) at rsync.c(544) [receiver=3.0.5]
8 r1 G3 z7 C+ k6 I: W: d: yrsync error: received SIGINT, SIGTERM, or SIGHUP (code 20) at rsync.c(544) [generator=3.0.5]
4 G8 M* R8 b: J9 a/ J- E说明:导致此问题多半是服务端服务没有被正常启动,到服务器上去查查服务是否有启动,然后查看下 /var/run/rsync.pid 文件是否存在,最干脆的方法是杀死已经启动了服务,然后再次启动服务或者让脚本加入系统启动服务级别然后shutdown -r now服务器
" M- V6 ?. e) o3 x1 ?4 F W7 w- N/ C+ R$ i# H
6、xnetid启动
4 q1 X/ B! P! N& `rsync: read error: Connection reset by peer (104)
4 X" V2 A- F, h5 d ]rsync error: error in rsync protocol data stream (code 12) at io.c(759) [receiver=3.0.5] 8 f. |/ }8 ?: x( B
查看rsync日志 ) s! f" ~: o0 c
rsync: unable to open configuration file "/etc/rsyncd.conf": No such file or directory
/ ]- \! N1 h- M" E! w0 o0 @- jxnetid查找的配置文件位置默认是/etc下,根据具体情况创建软链接。例如: . G2 }# p t7 |- m% e8 c" z% U- C
ln -s /etc/rsyncd/rsyncd.conf /etc/rsyncd.conf
- J- M6 r4 l/ n2 E: z- {; ?% o% J或者更改指定默认的配置文件路径,在/etc/xinetd.d/rsync配置文件中。 ( `9 }5 @; Y. U# \
Rsync configure:+ X4 p3 v* P! [5 }
配置一:' J: a) x/ a3 X4 |3 @
ignore errors
# i$ x& \2 Q2 E9 d! {说明:这个选项最好加上,否则再很多crontab的时候往往发生错误你也未可知,因为你不可能天天去看每时每刻去看log,不加上这个出现错误的几率相对会很高,因为任何大点的项目和系统,磁盘IO都是一个瓶颈1 }' [8 [, [% l% L
; ~6 G9 M: r0 w9 U
Rsync error: ' v8 I& J% w% S# ~% _; a- I
错误一: $ x5 f; l# ~1 ?4 J! x- e- L" ]
@ERROR: auth failed on module xxxxx 2 |( }8 j |# v7 V2 i9 \4 m
rsync: connection unexpectedly closed (90 bytes read so far)
1 R7 f6 I- j& g) hrsync error: error in rsync protocol data stream (code 12) at io.c(150) M- y' U6 j& \$ q/ P6 {& N
说明:这是因为密码设置错了,无法登入成功,检查一下rsync.pwd,看客服是否匹配。还有服务器端没启动rsync 服务也会出现这种情况。 错误二: $ D. J# h2 g$ P% R0 S* G! F8 t
password file must not be other-accessible
0 Q5 j( P- f" O/ c1 ?. [ S: tcontinuing without password file 0 f. k n2 f; p; W
Password: ; A' A6 X; N- Q
说明:这是因为rsyncd.pwd rsyncd.sec的权限不对,应该设置为600。如:chmod 600 rsyncd.pwd 错误三:
, s, L- F' ?- p J# I) a/ R@ERROR: chroot failed ( M& X( f5 Y& |. @+ n7 o; K; n2 Q
rsync: connection unexpectedly closed (75 bytes read so far) 0 [) Y+ S7 K4 e, f J
rsync error: error in rsync protocol data stream (code 12) at io.c(150)
1 x, ?4 a3 t' k, ^9 X说明:这是因为你在 rsync.conf 中设置的 path 路径不存在,要新建目录才能开启同步 错误四: 2 e$ `9 @, V% X3 J0 Z7 z: w+ X
rsync: failed to connect to 218.107.243.2: No route to host (113)
. b6 ^- v9 y# b8 trsync error: error in socket IO (code 10) at clientserver.c(104) [receiver=2.6.9]
$ u( b5 w9 ~% \: ^; U说明:防火墙问题导致,这个最好先彻底关闭防火墙,排错的基本法就是这样,无论是S还是C,还有ignore errors选项问题也会导致1 I9 H% L) I. p+ ?4 {0 F! J
" [, }3 F8 z% F9 B+ L; l; X错误五:# s9 Q7 Q( U9 T4 X" s8 p6 Q
@ERROR: access denied to www from unknown (192.168.1.123)
# } C% G. S( Arsync: connection unexpectedly closed (0 bytes received so far) [receiver]% l. n" q( h. q! Y8 Q$ y
rsync error: error in rsync protocol data stream (code 12) at io.c(359)
0 ^8 _* J1 \6 L; J说明:此问题很明显,是配置选项host allow的问题,初学者喜欢一个允许段做成一个配置,然后模块又是同一个,致使导致 错误六:
: _; s: M, W$ \" { } ^* W1 B4 Nrsync error: received SIGINT, SIGTERM, or SIGHUP (code 20) at rsync.c(244) [generator=2.6.9]% P" l! W; c1 R2 s0 w( C7 g
rsync error: received SIGUSR1 (code 19) at main.c(1182) [receiver=2.6.9]
8 C; G7 j F7 t8 e' [. m3 d说明:导致此问题多半是服务端服务没有被正常启动,到服务器上去查查服务是否有启动,然后查看下 /var/run/rsync.pid 文件是否存在,最干脆的方法是杀死已经启动了服务,然后再次启动服务或者让脚本加入系统启动服务级别然后shutdown -r now服务器 错误七:5 d6 h9 g5 O6 F+ M* P+ B
rsync: read error: Connection reset by peer (104)( G4 Q# s @) S' ^$ C
rsync error: error in rsync protocol data stream (code 12) at io.c(604) [sender=2.6.9]
' h# {& |6 y# t5 X+ |' {# h3 I说明:原数据目录里没有数据存在
" y' L1 p0 z4 L! b. y3 q rsync 错误与解决方法整理补充篇 由于我们经常使用rsync进行服务器文件的同步工作,但在配置过程中,会出现很多问题,下面的错误基本上都是通过客户端返回的错误进行分析。 另外查找错误过程中也学到了一个查看错误的方法-查看系统日志,我们操作的每步都会在日志上有说明,有时候报错看不懂,日志上都写的清清楚楚。 命令:cat /var/log/messages 问题一: @ERROR: auth failed on module bachup5 D; Z( w$ q8 k) J8 g* B
rsync error: error starting client-server protocol (code 5) at main.c(1522) [receiver=3.0.3] 原因:服务器端该模块(backup)需要验证用户名密码,但客户端没有提供正确的用户名密码,认证失败。 提供正确的用户名密码解决此问题。 " B. N( Y6 ^/ T- r5 _& t( K
这个问题比较蠢,如果可能你和我一样明明在模块里写了密码文件,怎么都不通,这个时候我劝你先检查一下所写模块中是不是和下图一样。比如,某处多了个s。
; T* b {: S5 T2 U 微信图片_20210306223602.p ...
问题二:110错误 -time out rsync: failed to connect to 203.100.192.66: Connection timed out (110)
+ s% _# y) _$ \' `$ O; A2 d9 d3 zrsync error: error in socket IO (code 10) at clientserver.c(124) [receiver=3.0.5] 原因: 检查服务器的端口netstat –tunlp,远程telnet测试。 可能因为客户端或者服务端的防火墙开启 导致无法通信,可以设置规则放行 rsync(873端口) 或者直接关闭防火墙。 ) M$ C7 Y- K: ]# G
在这里博主是重启过服务器,然后就报110了,直接开启rsync服务就行。 命令:service rsyncd start 问题三:113错误 -防火墙
/ e- _8 U4 R6 C4 \/ w3 f3 [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]" f% F. R) V6 m+ c
原因:
; }6 e- P G6 } H# ?) Q+ F1 E9 J防火墙问题导致,这个很简单,关闭防火墙就可以。不过博主还是被困在这里几个小时,因为linux防火墙分两种: -iptable和-firewall- U$ t$ m$ t. e* o
认识到这个问题首先查看系统的防火墙种类,查看防火墙状态即可
' H* ?% f& M" c9 Iservice iptable status
9 n4 V3 W1 j3 m0 ^$ Ofirewall-cmd --state 确定防火墙种类后再按对应方法将防火墙关闭即可。 问题四:1516错误 @ERROR: auth failed on module backup
% H$ ]. A; W# q' ?* X# e7 Q$ }& L' vrsync error: error starting client-server protocol (code 5) at main.c(1516) [Receiver=3.0.9]+ W. i, O4 Y. R/ i) s# ]3 K
8 _3 N/ E$ S. {! s* G# M
) J9 k8 I# ~/ y" w
+ j, J* C, |9 {8 m' O1 C3 f微信图片_20210306223651.p ...
% |: h* o+ g) T$ M! S
* |4 p* a& G% F, p* d; ?
! E9 h* {0 c4 G. P2 P
解决:这个问题错误差别很大,可查看系统日志查看错误,再搜索解决方法。 注意:一般这种情况都建立在可以连通的基础。去服务端查看系统日志,可以查看相关错误。 命令:cat /var/log/massages cat /var/log/rsyncd.log |