歡迎您光臨本站 註冊首頁

sersync 同步文件

←手機掃碼閱讀     火星人 @ 2014-03-09 , reply:0

Sersync 文件鏡像同步

192.168.1.229上配置如下:

rpm -q rsync

vi /etc/rsyncd.conf

uid=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

[benet]
path=/data/web/benet
comment = xoyo video files
ignore errors = yes
read only = no
hosts allow = 192.168.1.228/24
hosts deny = *

[accp]
path=/data/web/accp
comment = xoyo video files
ignore errors = yes
read only = no
hosts allow = 192.168.1.228/24
hosts deny = *

開啟rsync守護進程rsync --deamon

192.168.1.228上配置如下:

tar zxvf sersync2.5beta1_32bit_binary.tar.gz

cd GNU-Linux-x86

cp confxml.xml confxml2.xml

vi confxml.xml

<?xml version="1.0" encoding="ISO-8859-1"?>
<head version="2.4">
<host hostip="localhost" port="8008"></host>
<filter start="false">
<exclude expression="(.*).gz"></exclude>
<exclude expression="^info/*"></exclude>
</filter>
<inotify>
<delete start="true"/>
</inotify>
<sersync>
<localpath watch="/opt/benet" debug="false">
<remote ip="192.168.1.229" name="benet"/>
<!--<remote ip="192.168.8.39" name="tongbu"/>-->
<!--<remote ip="192.168.8.40" name="tongbu"/>-->
</localpath>
<rsync>


<auth start="false" users="root" passwordfile="/etc/rsync.pas"/>
</rsync>
<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>

vi confxml2.xml


<?xml version="1.0" encoding="ISO-8859-1"?>
<head version="2.4">
<host hostip="localhost" port="8008"></host>
<filter start="false">
<exclude expression="(.*).gz"></exclude>
<exclude expression="^info/*"></exclude>
</filter>


<inotify>
<delete start="true"/>
</inotify>
<sersync>
<localpath watch="/opt/accp" debug="false">
<remote ip="192.168.1.229" name="accp"/>
<!--<remote ip="192.168.8.39" name="tongbu"/>-->
<!--<remote ip="192.168.8.40" name="tongbu"/>-->
</localpath>
<rsync>
<auth start="false" users="root" passwordfile="/etc/rsync.pas"/>
</rsync>
<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>

開啟sersync守護進程 ./sersync2 -o confxml.xml -d

./sersync2 -o confxml2.xml -d

測試:

在192.168.1.228上 /opt/benet/ 下創建文件 touch aa.txt

在192.168.1.229上/data/web/benet/ 下看是否同步過來.


[火星人 ] sersync 同步文件已經有486次圍觀

http://coctec.com/docs/linux/show-post-49177.html