该工具详细说明和下载地点:http://code.google.com/p/sersync/ 
 
. 拓扑图
安装sersync实现服务器同步和镜像_服务器
       说明:图中A为源文件服务器,同步数据到BCD三台服务器
 
二.相关配置说明
 
  1ABCD分别开启rsync,以守护进程的方式。
  2A机上安装sersync
  3A机的sersync是以rsync能正常工作为前提,请测试好了再安装。
 
三.具体安装
 
1ABCD分别安装3.0以下的rsync
   # yum –y install rsync
 
2) 编辑配置文件rsyncd.conf
                   gid = root
                   use chroot = no
                   max connections = 4000
                  log file=/var/log/rsyncd.log
                 pid file=/var/run/rsyncd.pid
                  lock file=/var/run/rsyncd.lock
 
                 [tongbu]         #定义了一个tongbu的模块
                 path=/opt/tongbu
                comment = 123
                ignore errors = yes
                auth users = root           #开启认证模块
                secrets file = /etc/rsyncd.secrets#密码文件
                read only = no
                hosts allow =192.168.109.0/24#访问权限设置
                 hosts deny = *
 
3配置密码文件rsyncd. secrets
        这个密码文件只能在BCD上写如下内容:
                       # cat /etc/rsyncd.secrets  
           root:root1
A上只是一个单纯的写了密码的文件
                  # cat /etc/rsyncd.secrets  
           root1
      然后都chmod 600
 
 4)开启rsync并测试
 
ABCD机分别以守护进程的方式开启
rsync --daemon --config=/etc/rsyncd.conf
   测试A机上推
                 rsync -vzrtopg --progress --password-file=/etc/rsyncd.secrets /opt/tongbu root@192.168.0.151::tongbu
                A机上拉
                rsync -vzrtopg --progress root@192.168.0.151::tongbu /opt/tongbu --password-file=/etc/rsyncd.secrets
        
              5)确实测试无误了,再在A机上安装sersync
            
             tar -zxvf sersync2.4_64bit_binary.tar.gz
              cd GNU-Linux-x86/
             vi confxml.xml
 
     <?xml version="1.0" encoding="ISO-8859-1"?>
<head version="2.4">
    <host hostip="localhost" port="8008"></host>#1,本地主机配置
    <filter start="false">
        <exclude expression="(.*)\.gz"></exclude>
        <exclude expression="^info/*"></exclude>
    </filter>
    <inotify>
        <delete start="true"/>
    </inotify>
    <sersync>
        <localpath watch="/opt/tongbu" debug="false"> #2,watch填写需同步的本地路径
            <remote ip="192.168.109.4" name="tongbu"/> #3,remote填写要同步的远程主机IP与模块名称即BCD机的IP
            <!--<remote ip="192.168.8.39" name="tongbu"/>--> #注释掉无用的IP
            <!--<remote ip="192.168.8.40" name="tongbu"/>-->
        </localpath>
        <rsync>
            <auth start="true" users="root" passwordfile="/etc/rsyncd.secrets"/>   #4,true开启密码认证
        </rsync>
        <crontab start="true" schedule="60"> #start标签设置为true即设定多长时间对监控项目彻底同步一次
            <crontabfilter start="false">
                <exclude expression="*.php"></exclude>
                <exclude expression="info/*"></exclude>
            </crontabfilter>
        </crontab>
        <plugin start="false" name="refreshCDN"/> #plugin标签是在同步过程中使用插件
    </sersync>
 
 
    <plugin name="refreshCDN">#插件1
        <localpath watch="/data0/htdocs/cms.xoyo.com/site/">
            <cdninfo domainname="ccms.chinacache.com" port="80" username="xxxx" passwd="xxxx"/>
            <sendurl base="http://pic.xoyo.com/cms"/>
            <regexurl regex="false" match="cms.xoyo.com/site([/a-zA-Z0-9]*).xoyo.com/p_w_picpaths"/>
        </localpath>
    </plugin>
    <plugin name="socket">#插件2
        <localpath watch="/opt/tongbu">
            <deshost ip="192.168.0.151" port="8009"/>
        </localpath>
    </plugin>
</head>   
                 要注意的有这么几个地方
                1,本地IP和端口
                2,本地同步路径
                3,远程主机BCDIP
                4,是否开启密码认证
           
            6)启动
    
              ./sersync2 –d –r
安装sersync实现服务器同步和镜像_sersync_02
              这个是日志信息
安装sersync实现服务器同步和镜像_休闲_03
    
  这样的日志输出是正常的,至于产生“/.”的报错。和作者的命令设置有关。