RSYNC實現文件同步

1.安裝(客戶端服務端都要安裝)

yum -y install rsync

2.安裝xinetd

yum -y install xinetd

3.修改xinetd配置文件

修改 /etc/xinetd.d/rsync  把 disable = yes  改爲disable = no

4.創建rsync服務器配置文件/etc/rsyncd.conf

vi /etc/rsyncd.conf

uid = root
gid = root
port = 873
hosts allow = 192.168.1.10
hosts deny = *
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log
[ddsc]
path = /usr/share/nginx/html
comment = rsync files
ignore errors
read only = yes
list = no



5.啓動RSYNC

rsync --daemon


6.查看啓動狀態

netstat -anpt |grep 873

7.防火牆開啓策略

iptables -I INPUT -p tcp --dport 873 -j ACCEPT




客戶端:

安裝跟服務端一樣,只要創建一個空的配置文件然後啓動就可以

touch /etc/rsyncd.conf
rsync --daemon



開始同步:

在客戶端把服務端(192.168.1.100)的/usr/share/nginx/html目錄同步到本地/usr/share/nginx/html

rsync -vzrtopg --delete  --progress 192.168.3.100::ddsc /usr/share/nginx/html/


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章