由於阿里雲SLB不提供ECS間的數據同步服務,如果部署在SLB后端ECS上的應用服務是無狀態的,那么可以通過獨立的ECS或RDS服務來存儲數據;如果部署在SLB后端ECS上的應用服務是有狀態的,那么需要確保這些ECS上的數據是同步的。
我們通過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 也可以。
解決后:
receiving incremental file list
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
@ERROR: failed to open lock file rsync error: error starting client-server protocol (code 5) at main.c(1495) [receiver=3.0.6]
解決:配置文件 rsync.conf 中添加 lock file = rsyncd.lock 即可解決。
本文地址:http://www.tuicool.com/articles/me2IFjf
