sersync2实时同步

1. 多台服务器间的实时同步方案

方案一:sersync2,基于 boost1.41.0,inotify api,rsync command编写;

方案二: inotify-tools+rsync ,基于脚本语言编写;

方案三:Openduckbill(依赖于inotify- tools),基于脚本语言编写;

2.sersync2的实时同步实践

a. 主服务器:10.90.3.81

#tar xvfz sersync2.5.4_64bit_binary_stable_final.tar.gz 
#cp GNU-Linux-x86/confxml.xml  /etc/sersync2/
#cp GNU-Linux-x86/sersync2  /usr/bin/
--------------------------------
#vim  /etc/sersync2/confxml.xml
--------------------------------
<localpath watch="/data/ifengsite/htdocs/cmshtml">
    <remote ip="10.90.3.82" name="cmshtml"/>
    <!--<remote ip="192.168.8.39" name="tongbu"/>-->
    <!--<remote ip="192.168.8.40" name="tongbu"/>-->
</localpath>

<failLog path="/data/logs/rsync/rsync_fail.log" timeToExecute="60"/>
--------------------------------
#sersync2 -n 5 -r -d -o /etc/sersync2/confxml.xml

b. 主服务器:10.90.3.82

#rpm -qa|grep rsync (rsync-3.0.6-9.el6_4.1.x86_64)
#yum install rsync (>=3.0.0)
#rsync --daemon
#netstat -npl | grep 873
#vim  /etc/rsyncd.conf
--------------------------------
gid=root
max connections=36000
use chroot=no
log file=/var/log/rsyncd.log
pid file=/var/run/rsyncd.pid
lock file=/var/run/rsyncd.lock
[cmshtml]
path=/data/ifengsite/htdocs/cms/frag/pics
uid = root
comment = cms_static_files
ignore errors = yes
read only = no
hosts allow = 10.90.3.81
hosts deny = *

3. sersync2常用命令列表

./sersync -d,指定以守护进程运行
./sersync -r,指定运行前完整同步一次
./sersync -o XXXX.xml,指定配置文件
./sersync -n num,指定线程数,默认10
./sersync -m pluginName,指定插件运行,不同步
./sersync -help,帮助命令

4.参考链接

https://code.google.com/archive/p/sersync/downloads
http://www.oschina.net/p/sersync/


猜你喜欢

转载自blog.csdn.net/yccn214/article/details/52179783