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/
相关文章
相关标签/搜索