首页 电脑 电脑学堂 查看内容

用sersync进行实时同步数据

2011-9-27 16:16 528 0

摘要:   同步目标服务器  Vim /etc/rsyncd.confuid=root  gid=root  max connections=36000  use&nb...
关键词: nbsp 同步 服务器 rsyncd sersync 目录 sersyncphp 实时 file 进程

  同步目标服务器  Vim /etc/rsyncd.confuid=root  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     [web]  path=/data0/web  comment  =  McShell web  ignore errors = yes  read only = no hosts allow =  10.1.0.0/24  hosts deny = *  编辑完之后执行rsync –daemon 开启守护进程 剩下的服务器都一样配置。   同步服务器的confxml.xml如下  <?xml version="1.0" encoding="ISO-8859-1"?> <head version="2.2">     <host hostip="10.1.0.2" port="8008"></host>     <filter start="false">         <exclude expression="(.*)\.gz"></exclude>         <exclude expression="^info/*"></exclude>     </filter>     <sersync>         <localpath watch="/data0/web " debug="false">             <remote ip="10.1.0.4" name="web"/>             <remote ip="10.1.0.5" name="web"/>             <remote ip="10.1.0.6" name="web"/>                <!--<remote ip="192.168.8.39" name="tongbu"/>-->         </localpath>            <rsyncauth start="flase" users="www" passwordfile="/etc/rsync.pas"/>         <crontab start="false" schedule="600">             <crontabfilter start="false">                 <exclude expression="*.php"></exclude>                 <exclude expression="info/*"></exclude>             </crontabfilter>         </crontab> </sersync> </head>  然后执行: ./sersyncphp –d  在主服务器上开启sersync守护进程,使sersync在后台运行,开启实时同步。. ./sersyncphp –r   在开启实时监控的之前对主服务器目录与远程目标机目录进行一次整体同步 扩展: 如果进行多个目录同步,复制出多个confxml.xml即可,名称根据自己来定义,不可相同。 执行 ./sersync -o XXXX.xml
声明:文章版权归原作者所有 部分文章转自互联网 如有侵权请联系 [邮箱地址] 删除

路过

雷人

握手

鲜花

鸡蛋

最新评论

返回顶部