保持192.168.1.5和192.168.1.6中/www/mingxiao数据相同
这里提供两种实现方式,请参考我的另一篇博文:http://mingxiao.blog.51cto.com/8124243/1641385
进192.168.1.5
安装sersync和inotify
# yum install inotify-tools # tar xf sersync2.5.4_64bit_binary_stable_final.tar.gz -C /usr/local/sersync # cd /usr/local/sersync
编辑confxml.xml
<head version="2.5"> <host hostip="192.168.1.5" port="8008"></host> ....... <sersync> <localpath watch="/www/mingxiao"> <remote ip="192.168.1.6" name="xiaoming"/> </localpath> <rsync> <commonParams params="-zrtopg"/> <userDefinedPort start="false" port="874"/><!-- port=874 --> <auth start="true" users="xiaoming" passwordfile="/etc/rsync.pass"/> </rsync> <failLog path="/tmp/rsync_fail_log.sh" timeToExecute="60"/><!--default every 60mins execute once--> <crontab start="true" schedule="300"><!--600mins--> .......
编辑 /etc/rsync.pass,添加以下内容
xiaoming
#chmod 600 /etc/rsync.pass
进192.168.1.6
# useradd xiaoming # echo xiaoming | passwd --stdin xiaoming
为rsync提供配置文件,编辑/etc/rsyncd.conf
uid=nobody gid=nobody use chroot = no max connections =10 strict modes = yes pid file = /var/run/rsyncd.pid lock file = /var/run/rsync.lock log file = /var/log/rsyncd.log [xiaoming] path = /www/mingxiao comment = xiaoming file ignore errors read only = no write only = no host allow = 192.168.1.5 list = false uid = root gid = root auth user = xiaoming secrets file = /etc/server.pass
编辑/etc/server.pass
xiaoming
# chmod 600 /etc/server.pass
#chkconfig rsync on # service xinetd start
进192.168.1.5
/usr/local/sersync/sersync2 -r -o /usr/local/sersync/confxml.xml -n 5 -d
这时已配置完毕。
时间: 2024-10-10 21:35:49