1. 程式人生 > >rsync同步報錯原因以及解決方案:

rsync同步報錯原因以及解決方案:

[[email protected] data]# rsync -avz rsync://[email protected]/www /data
rsync: failed to connect to 192.168.17.13: Connection refused (111)
rsync error: error in socket IO (code 10) at clientserver.c(124) [receiver=3.0.6]

NFS儲存伺服器在使用使用命令備份NFS儲存伺服器時,報連線失敗錯誤。 我登入BACKUP伺服器進行檢視,發現rsync配置檔案並沒有問題,檢查後發現rsync服務並未開啟,造成客戶端訪問報錯。

[[email protected] data]# lsof -i :873
[[email protected] data]# netstat -lntup|grep rsync
[[email protected] data]# ps aux|grep rsync
root      10104  0.0  0.1 103324   852 pts/0    S+   10:50   0:00 grep --color rsync

lsof -i :PORT 檢視埠是否開啟 netstat -lntup|grep rsync 檢視服務是否開啟 ps aux|grep rsync 檢視是否有程序存在

[[email protected] data]# rsync --daemon
[[email protected] data]# lsof -i :873
COMMAND  PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
rsync   7934 root    4u  IPv4  54565      0t0  TCP *:rsync (LISTEN)
rsync   7934 root    5u  IPv6  54566      0t0  TCP *:rsync (LISTEN)

使用rsync --daemon以守護程序的方式啟動rsync。 lsof -i :873檢視是否開啟。

[[email protected] ~]# rsync -avz /root/a.sh rsync://[email protected]/www --password-file=/etc/rsync.password 
sending incremental file list
a.sh

sent 164 bytes  received 27 bytes  382.00 bytes/sec
total size is 124  speedup is 0.65
[[email protected] data]# rsync -avz rsync://[email protected]/www /data --password-file=/etc/rsync.password 
receiving incremental file list

sent 56 bytes  received 454 bytes  1020.00 bytes/sec
total size is 4471  speedup is 8.77

儲存伺服器測試。 完成!!!