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 = rootgid = rootport = 873hosts allow = 192.168.1.10hosts deny = *pid file = /var/run/rsyncd.pidlock file = /var/run/rsync.locklog file = /var/log/rsyncd.log[ddsc]path = /usr/share/nginx/htmlcomment = rsync filesignore errorsread only = yeslist = no
5.启动RSYNC
rsync --daemon
6.查看启动状态
netstat -anpt |grep 873
7.防火墙开启策略
iptables -I INPUT -p tcp --dport 873 -j ACCEPT
客户端:
安装跟服务端一样,只要创建一个空的配置文件然后启动就可以
touch /etc/rsyncd.confrsync --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/