手机版
你好,游客 登录 注册
背景:
阅读新闻

Sersync+Rsync 增量实时同步

[日期:2012-11-10] 来源:Linux社区  作者:learon [字体:大 中 小]

二、 sersync2服务器: 

这里有两个连接一个是针对64位的,一个是32位的,所以一定要选好否则后面出错了你排查不到原因,所以在这里叮嘱一下。

wget http://sersync.googlecode.com/files/sersync2.5_64bit_binary_stable_final.tar.gz

wget http://sersync.googlecode.com/files/sersync2.5_32bit_binary_stable_final.tar.gz

[root@acong tools]# tar zxf sersync2.5_32bit_binary_stable_final.tar.gz
 
[root@acong tools]# cd GNU-Linux-x86/
 
[root@acong GNU-Linux-x86]# ll
 
total 1496
 
-rwxr-xr-x 1 root root    2217 Aug  3 00:56 confxml.xml
 
-rwxr-xr-x 1 root root 1520176 Jul  4  2010 sersync2
 
[root@acong GNU-Linux-x86]# vim confxml.xml        ##找到一下模块
 
<sersync>   
 
 <localpath watch="/opt/tongbu1">
 
            <remote ip="172.16.3.21" name="tongbu1"/>         
 
## 指定 rsyncd 服务器的地址和备份的模块名称
 
            <!--<remote ip="192.168.8.39" name="tongbu"/>-->
 
            <!--<remote ip="192.168.8.40" name="tongbu"/>-->
 
        </localpath>
 
        <rsync>
 
            <commonParams params="-artuz"/>
 
            <auth start="false" users="root" passwordfile="/etc/rsync.pas"/>
 
            <userDefinedPort start="false" port="874"/><!-- port=874 -->
 
            <timeout start="false" time="100"/><!-- timeout=100 -->
 
            <ssh start="false"/>
 
        </rsync>
 
<failLog path="/var/log/rsync_fail.log" timeToExecute="60"/><!--default every 60mins execute once--> ##也可以把log文件指定到你熟悉的位置
 
[root@acong GNU-Linux-x86]# mkdir /opt/tongbu1 -p 建立目录
 
[root@acong GNU-Linux-x86]# cd /opt/tongbu1/
 
[root@liyao GNU-Linux-x86]# mkdir /etc/sersync2
 
[root@liyao GNU-Linux-x86]# cp confxml.xml /etc/sersync2/
 
[root@liyao GNU-Linux-x86]# cp sersync2 /usr/bin/
 


[root@rrd ~]# sersync2 -r -d -o /etc/sersync2/confxml.xml
 
set the system param
 
execute:echo 50000000 > /proc/sys/fs/inotify/max_user_watches
 
execute:echo 327679 > /proc/sys/fs/inotify/max_queued_events
 
parse the command param
 
option: -r      rsync all the local files to the remote servers before the sersync work
 
option: -d      run as a daemon
 
option: -o      config xml name:  /etc/sersync2/confxml.xml
 
daemon thread num: 10
 
parse xml config file
 
host ip : localhost    host port: 8008
 
daemon start,sersync run behind the console
 
config xml parse success
 
please set /etc/rsyncd.conf max connections=0 Manually
 
sersync working thread 12  = 1(primary thread) + 1(fail retry thread) + 10(daemon sub threads)
 
Max threads numbers is: 22 = 12(Thread pool nums) + 10(Sub threads)
 
please according your cpu ,use -n param to adjust the cpu rate
 
------------------------------------------
 
rsync the directory recursivly to the remote servers once
 
working please wait...
 
execute command: cd /opt/tongbu1 && rsync -artuz -R --delete ./ 172.16.0.26::tongbu1 >/dev/null 2>&1
 
run the sersync:
 
watch path is: /opt/tongbu1

linux
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款