XML文件说明
sersync可选功能是通过xml配置文件来实现的,基本配置文件如下:
<?xml version="1.0" encoding="ISO-8859-1"?>
<head version="2.5">
<host hostip="localhost" port="8008"></host>
<filter start="false">
<exclude expression="(.*).gz"></exclude>
<exclude expression="^info/*"></exclude>
</filter>
<inotify>
<delete start="true"/>
<createFolder start="true"/>
<createFile start="true"/>
</inotify>
<debug start="false"/>
<sersync>
<localpath watch="/opt/tongbu">
<remote ip="192.168.0.104" name="tongbu1"/>
<!--<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="/tmp/rsync_fail_log.sh" timeToExecute="60"/><!--default every 60min execute once-->
<crontab start="false" schedule="600"><!--600mins-->
<crontabfilter start="false">
<exclude expression="*.gz"></exclude>
<exclude expression="info/*"></exclude>
</crontabfilter>
</crontab>
<plugin start="false" name="command"/>
</sersync>
下面做逐行的进行解释说明:
<host hostip="localhost" port="8008"></host>
hostip与port是针对插件的保留字段,对于同步功能没有任何作用,保留默认即可。
filter文件过滤功能
对于sersync监控的文件,会默认过滤系统的临时文件(以“.”开头,以“~”结尾),除了这些文件外,可以自定义其他需要过滤的文件。
<filter start="true">
<exclude expression="(.*).gz"></exclude>
<exclude expression="^info/*"></exclude>
</filter>
将start设置为 true,在exclude标签中,填写正则表达式,默认给出两个例子分别是过滤以”.gz”结尾的文件与过滤监控目录下的info路径(监控路径/info /*),可以根据需要添加,但开启的时候,自己测试一下,正则表达式如果出现错误,控制台会有提示。相比较使用rsync 的exclude功能,被过滤的路径,不会加入监控,大大减少rsync的通讯量。
inotify监控参数设定(优化)
对于inotify监控参数可以进行设置,根据您项目的特点优化srsync。
<inotify>
<delete start="true"/>
<createFolder start="true"/>
<createFile start="true"/>
</inotify>
sersync可选功能是通过xml配置文件来实现的,基本配置文件如下:
<?xml version="1.0" encoding="ISO-8859-1"?>
<head version="2.5">
<host hostip="localhost" port="8008"></host>
<filter start="false">
<exclude expression="(.*).gz"></exclude>
<exclude expression="^info/*"></exclude>
</filter>
<inotify>
<delete start="true"/>
<createFolder start="true"/>
<createFile start="true"/>
</inotify>
<debug start="false"/>
<sersync>
<localpath watch="/opt/tongbu">
<remote ip="192.168.0.104" name="tongbu1"/>
<!--<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="/tmp/rsync_fail_log.sh" timeToExecute="60"/><!--default every 60min execute once-->
<crontab start="false" schedule="600"><!--600mins-->
<crontabfilter start="false">
<exclude expression="*.gz"></exclude>
<exclude expression="info/*"></exclude>
</crontabfilter>
</crontab>
<plugin start="false" name="command"/>
</sersync>
下面做逐行的进行解释说明:
<host hostip="localhost" port="8008"></host>
hostip与port是针对插件的保留字段,对于同步功能没有任何作用,保留默认即可。
filter文件过滤功能
对于sersync监控的文件,会默认过滤系统的临时文件(以“.”开头,以“~”结尾),除了这些文件外,可以自定义其他需要过滤的文件。
<filter start="true">
<exclude expression="(.*).gz"></exclude>
<exclude expression="^info/*"></exclude>
</filter>
将start设置为 true,在exclude标签中,填写正则表达式,默认给出两个例子分别是过滤以”.gz”结尾的文件与过滤监控目录下的info路径(监控路径/info /*),可以根据需要添加,但开启的时候,自己测试一下,正则表达式如果出现错误,控制台会有提示。相比较使用rsync 的exclude功能,被过滤的路径,不会加入监控,大大减少rsync的通讯量。
inotify监控参数设定(优化)
对于inotify监控参数可以进行设置,根据您项目的特点优化srsync。
<inotify>
<delete start="true"/>
<createFolder start="true"/>
<createFile start="true"/>
</inotify>








