首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 操作系统 >

sersync同步配备

2012-08-15 
sersync同步配置head version2.2??? host hostip192.168.10.126 port8008/host??? filter

sersync同步配置
<head version="2.2">
??? <host hostip="192.168.10.126" port="8008"></host>
??? <filter start="false">
??????? <exclude expression="(.*)\.gz"></exclude>
??????? <exclude expression="^info/*"></exclude>
??? </filter>
??? <sersync>
??????? <localpath watch="/opt/tongbu" debug="false">
??????????? <remote ip="192.168.134.54" name="tongbu"/>
??????????? <!--<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>
??????? <plugin start="false" name="refreshCDN"/>
??? </sersync>
??? <plugin name="refreshCDN">
??????? <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/images"/>
??????? </localpath>
??? </plugin>
??? <plugin name="socket">
??????? <localpath watch="/opt/tongbu">
??????????? <deshost ip="192.168.138.20" port="8009"/>
??????? </localpath>
??? </plugin>
</head>
在服务器端192.168.134.54配置如下:
下载rsync源码包:rsync-3.0.7.tar.gz
tar -zxvf rsync-3.0.7.tar.gz
cd rsync-3.0.7 ; ./configure --prefix=/usr/local/rsync --disable-ipv6 ;make && make install
mkdir -p /opt/tongbu
vi /etc/rsyncd.conf
[tongbu]
path=/opt/tongbu
uid = root???? //这个也很重要,否则会报错
comment = test
ignore errors = yes
read only = no
hosts allow = 192.168.10.126/24
hosts deny = *
启动rsync:
rsync --daemon
检查rsync是否起来:
lsof -i :873
COMMAND PID USER?? FD?? TYPE DEVICE SIZE NODE NAME
rsync?? 2625 root??? 4u IPv6?? 5662?????? TCP *:rsync (LISTEN)
rsync?? 2625 root??? 5u IPv4?? 5663?????? TCP *:rsync (LISTEN)
表示已经起来,返回空,表示没有起来
确保防火墙能使 tcp的873端口通过
至此,2台服务器的配置完毕,然后再10.126上启动sersync
cd GNU-Linux-x86
./sersync2.4 -r -d
看下192.168.10.126机器上的/opt/tongbu/目录下的文件是否同步到192.168.134.54 的/opt/tongbu/的目录下,如果有说明成功了!(我这样配置是成功的)同步的时间几乎是实时的,非常的棒!!!
说明:
sersync2.4 的选项:
-h 查看帮助文件
-r 在同步程序开启前,将整个路径跟远程服务器同步一遍
-d 开启守护进程模式在后台运行
-o 指定配置文件,如果不是默认的confxml.xml的情况下
-n 指定同步守护线程数量,默认为10个,适用于现在的4核服务器。如果需增加或减少使用 '-n 数量'
通常最常用的启动方法:
-m 值调用插件程序,不调用同步数据机制
./sersync2.4 -d -r
原作者网站:
http://code.google.com/p/sersync/

热点排行