天天看點

Rsync 常見錯誤及解決方法

Rsync 常見錯誤及解決方法

時間 2014-08-11 20:40:22  LixiPHP

原文  http://blog.lixiphp.com/rsync-errors-solved/

主題 rsync Linux

由于阿裡雲SLB不提供ECS間的資料同步服務,如果部署在SLB後端ECS上的應用服務是無狀态的,那麼可以通過獨立的ECS或RDS服務來存儲資料;如果部署在SLB後端ECS上的應用服務是有狀态的,那麼需要確定這些ECS上的資料是同步的。

我們通過Rsync來實作多個ECS之間的資料同步。

Rsync 常見錯誤及解決方法
通過Rsync來實作多個ECS之間的資料同步,請檢視此文。

問題 @ERROR: chroot failed

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

原因:

伺服器端的目錄不存在或無權限。

解決辦法:

建立目錄并修正權限可解決問題。

問題 skipping non-regular file

receiving incremental file list

skipping non-regular file “vendor/bin/doctrine”

skipping non-regular file “vendor/bin/doctrine.php”

sent 1990 bytes received 489209 bytes 327466.00 bytes/sec total size is 182515746 speedup is 371.57

source源檔案有軟連結。

解決方法:

修改為 rsync -va,其中 -a == -rlptgoD (no -H,-A,-X) 或者 rsync -rvltOD 也可以。

解決後:

vendor/bin/doctrine -> ../doctrine/orm/bin/doctrine

vendor/bin/doctrine.php -> ../doctrine/orm/bin/doctrine.php

sent 1998 bytes received 489279 bytes 327518.00 bytes/sec total size is 182515746 speedup is 371.51

問題@ERROR: module is read only

sending incremental file list

ERROR: module is read only

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

rsync: read error: Connection reset by peer (104)

rsync error: error in rsync protocol data stream (code 12) at io.c(759) [sender=3.0.6]

source源伺服器端權限設定read為only隻讀權限。

read only = false

問題@ERROR: auth failed on module tee

@ERROR: auth failed on module tee rsync error: error starting client-server protocol (code 5) at main.c(1522) [receiver=3.0.6]

伺服器端該子產品(tee)需要驗證使用者名密碼,但用戶端沒有提供正确的使用者名密碼,認證失敗。

提供正确的使用者名密碼解決此問題。

問題 @ERROR: Unknown module ‘tee_nonexists’

@ERROR: Unknown module ‘tee_nonexists’ rsync error: error starting client-server protocol (code 5) at main.c(1522) [receiver=3.0.6]

伺服器不存在指定子產品。

提供正确的子產品名或在伺服器端修改成你要的子產品以解決問題。

問題 password file must not be other-accessible

password file must not be other-accessible

continuing without password file

Password:

這是因為rsyncd.pwd rsyncd.secrets的權限不對,應該設定為600。

chmod 600 rsyncd.pwd

問題 rsync: failed to connect No route to host

rsync: failed to connect to 192.168.1.10: No route to host (113) rsync error: error in socket IO (code 10) at clientserver.c(104) [receiver=3.0.6]

對方沒開機、防火牆阻擋、通過的網絡上有防火牆阻擋,都有可能。

在iptables 中開放該端口,語句如下:

iptables -I INPUT -p tcp –dport 873 -j ACCEPT

rsync預設端口873,其實就是把tcp udp的873端口打開。

問題 rsync error: error starting client-server protocol

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

/etc/rsyncd.conf配置檔案内容有錯誤。請正确核對配置檔案。

問題 rsync: chown “” failed: Invalid argument (22)

rsync: chown “” failed: Invalid argument (22)

權限無法複制。去掉同步權限的參數即可。(這種情況多見于Linux向Windows的時候)

問題 @ERROR: daemon security issue — contact admin

@ERROR: daemon security issue — contact admin rsync error: error starting client-server protocol (code 5) at main.c(1530) [sender=3.0.6]

同步的目錄裡面有權限不足的軟連接配接檔案,需要伺服器端的/etc/rsyncd.conf打開use chroot = yes。

問題 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 服務,開啟服務。

問題 @ERROR: failed to open lock file