Rsync服務常見問題彙總講解:(CentOS 6.5操作系統)
=========================================================================
1、客戶端錯誤信息:No route to host
rsync客戶端報錯信息:
[root@localhost scripts]# rsync -avz [email protected]::oldboy /data/ --password-file=/etc/rsync.password
rsync: failed to connect to 10.90.3.115 (10.90.3.115): No route to host (113)
rsync error: error in socket IO (code 10) at clientserver.c(125) [Receiver=3.1.2]
異常問題解決:
關閉Rsync服務端的防火牆服務(iptables)
[root@localhost /]# service iptables stop
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Flushing firewall rules: [ OK ]
iptables: Unloading modules: [ OK ]
=========================================================================
2、ERROR: The remote path must start with a module name not a /
rsync客戶端執行rsync命令錯誤:
[root@localhost /]# rsync -avz [email protected]::/oldboy /data/ --password-file=/etc/rsync.password
ERROR: The remote path must start with a module name not a /
rsync error: error starting client-server protocol (code 5) at main.c(1648) [Receiver=3.1.2]
異常問題解決:
rsync命令語法理解錯誤,::/oldboy是錯誤的語法,應該爲:"::oldboy(rsync模塊)"
=========================================================================
3、@ERROR: auth failed on module oldboy
客戶端錯誤信息:
[root@localhost scripts]# rsync -avz [email protected]::oldboy /data/ --password-file=/etc/rsync.password
@ERROR: auth failed on module oldboy
rsync error: error starting client-server protocol (code 5) at main.c(1648) [Receiver=3.1.2]
異常問題解決:
1. 密碼真的輸入錯誤,用戶名真的錯誤
2. secrets file = /etc/rsync.password指定的密碼文件和實際密碼文件名稱不一致
3. /etc/rsync.password文件權限不是600
4. rsync_backup:oldboy123密碼配置文件後面注意不要有空格
5. rsync客戶端密碼文件中只輸入密碼信息即可,不要輸入虛擬認證用戶名稱
6、/etc/rsyncd.conf配置文件中的虛擬用戶一定要存在,並且命令中的虛擬用戶要正確
7、/etc/rsync.password密碼文件權限不對,不是600權限。
=========================================================================
4、@ERROR: Unknown module 'oldboy'
客戶端報錯信息:
[root@localhost /]# rsync -avz [email protected]::oldboy /data/ --password-file=/etc/rsync.password
@ERROR: Unknown module 'oldboy'
rsync error: error starting client-server protocol (code 5) at main.c(1648) [Receiver=3.1.2]
異常問題解決:
1、/etc/rsyncd.conf配置文件中的模塊名稱書寫錯誤
2、配置文件中的IP或網段限制錯誤
=========================================================================
5、Permission denied
客戶端報錯信息:
[root@localhost /]# rsync -avz [email protected]::oldboy /data/ --password-file=/etc/rsync.password
receiving incremental file list
rsync: link_stat "." (in oldboy) failed: Permission denied (13)
sent 8 bytes received 87 bytes 63.33 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1650) [Receiver=3.1.2]
異常問題解決:
1、共享目錄的屬主和屬組不正確,不是rsync
2、共享目錄的權限不對,不是755權限
=========================================================================
6、Connection refused (111)
客戶端報錯信息:
[root@localhost /]# rsync -avz [email protected]::oldboy /data/ --password-file=/etc/rsync.password
rsync: failed to connect to 10.90.3.115 (10.90.3.115): Connection refused (111)
rsync error: error in socket IO (code 10) at clientserver.c(125) [Receiver=3.1.2]
Rsync服務沒有正確啓動。
問題解決如下:
重啓或啓動rsync服務(服務端)
[root@localhost /]# rsync --daemon
[root@localhost /]# ps -ef|grep rsync
root 2543 1 0 04:15 ? 00:00:00 rsync --daemon
root 2546 1668 0 04:15 pts/0 00:00:00 grep rsync
[root@localhost /]# netstat -lnpt|grep rsync
tcp 0 0 0.0.0.0:873 0.0.0.0:* LISTEN 2543/rsync
tcp 0 0 :::873 :::* LISTEN 2543/rsync
=========================================================================
Rsync服務端排錯思路:
1、查看rsync服務配置文件路徑是否正確 /etc/rsyncd.conf
2、查看配置文件例的host allow,host deny,允許的ip網段是否是允許客戶端訪問的ip網段
3、查看配置文件中path參數裏的路徑是否存在,權限是否正確(正常應爲配置文件中的UUID參數對應的屬主和組)
4、查看rsync服務是否啓動,端口是否存在 ps -ef netstat -lntup
5、查看iptables防火牆和SELinux是否開啓允許rsync服務通過,也可以關閉
6、查看服務端rsync配置文件裏的密碼權限是否爲600 密碼文件格式是否正確,正確格式(用戶名:密碼)文件路徑和配置文件裏的secrect files 參數對應
7、如果是推送數據,要查看,配置rsyncd.conf 文件中用戶是否對模塊下目錄有可讀的權限
=========================================================================
客戶端排錯思路:
1、查看客戶端rsync配置的密碼文件是否爲600的權限,密碼文件格式是否正確,注意:僅需要有密碼,並且和服務端的密碼一致
2、用telnet鏈接rsync服務器ip地址873端口,查看服務是否啓動(可測試服務端防火牆是否阻擋telnet10.0.0.100 873)
3、客戶端執行命令是 rsync -avzP [email protected]::backup/test/test/ --password-file=/etc/rsync.password
4、此命令要記清楚尤其10.0.0.100::backup/test/處的雙引號及隨後的backup爲模塊名稱