2016年3月6日 星期日

CentOS 6 rsync 設定

安裝 rsync (兩邊都要裝)
yum install xinetd rsync -y

啟動
service xinetd start

設定開機啟動
chkconfig xinetd on


遠端主機:

設定防火牆
vi /etc/sysconfig/iptables

-A INPUT -i eth0 -p tcp -s  xxx.xxx.xxx.xxx/32 --dport 873 -j ACCEPT

service iptables  restart


使用SSH連線,免設密碼檔

編輯rsync設定檔

#vi /etc/rsyncd.conf

[sfs3]
path = /var/www/html/sfs3         //要同步的資料夾
hosts allow = xxx.xxx.xxx.xxx   //sfs3主機ip
hosts deny = *
list = true
uid = root
gid =root
readonly = false


# vi /etc/xinetd.d/rsync

找到  disable = yes 修改為  disable = no,然後重新啟動 xinetd

# service xinetd restart


SFS3主機

crontab -e  加入

45 2 * * * rsync -avz --delete /var/www/html/sfs3/ 140.128.185.37::sfs3

沒有留言:

張貼留言