RSYNC實現文件同步

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

yum -y install rsync

2.安裝xinetdnginx

yum -y install xinetd

3.修改xinetd配置文件bash

修改 /etc/xinetd.d/rsync  把 disable = yes  改成disable = no服務器

4.建立rsync服務器配置文件/etc/rsyncd.conftcp

vi /etc/rsyncd.confide

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.啓動RSYNCui

rsync --daemon


6.查看啓動狀態htm

netstat -anpt |grep 873

7.防火牆開啓策略ip

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/
相關文章
相關標籤/搜索