rsync 同步目錄
阿新 • • 發佈:2018-12-07
Try `rm --help' for more information.
rsync: failed to connect to 192.168.129.58: Connection refused (111)
rsync error: error in socket IO (code 10) at clientserver.c(124) [sender=3.0.6]
出現這個錯誤的原因是因為服務端的服務沒開起來,或者埠的問題。
檢查rsync服務是否已經啟動,
ps -ef | grep 'rsync'
可以看到rsync服務並沒有啟動。
手動啟動rsync服務
我的 rsync 在 /etc/xinetd.d 下
可以看到啟動成功
可能是密碼或許可權問題
服務端
/etc/rsyncd.passwd
格式為: username:password
rsync_back:123456
chmod 600 /etc/rsyncd.secrets
客戶端
/etc/rsync.pas
格式為: password
123465
chmod 600 /etc/rsync.pas
修改rsyncd.conf
把 rsync 修改為0
uid = 0
gid = 0
現在貼出配置 伺服器A /etc/rsync.conf
uid = 0
gid = 0
use chroot = no
max connections = 200
timeout = 300
motd file = /var/rsyncd/rsync.motd
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log
###########下面指定模組,並設定模組配置引數,可以建立多個模組###########
[backup] # 模組名稱
path = /mysqlback/backup/
ignore errors
read only = false
write only = false
list = false
hosts allow = *
auth users = rsync_backup
secrets file = /etc/rsyncd.passwd
/etc/rsyncd.passwd
格式為: username:password
rsync_back:123456
chmod 600 /etc/rsyncd.secrets
啟動服務
/usr/bin/rsync –daemon –config=/etc/rsyncd.conf
伺服器B
rsync -a --password-file=/etc/rsync.pas /data/backup/ [email protected]::backup
/etc/rsync.pas
格式為: password
123465
chmod 600 /etc/rsync.pas
參考檔案 http://blog.51cto.com/ouyangjun/1691923