服务器维护,服务器代维,安全设置,漏洞扫描,入侵检测服务

dirtysea 发表于 2010-4-14 22:40:31

金山逍遥网sersync服务器实时镜像、自动同步开源程序

<span class="Apple-style-span" style="color: rgb(51, 51, 51); font-family: Arial; line-height: 18px; font-size: 12px; "><div class="tit" style="font-family: Arial; word-wrap: break-word; word-break: break-all; visibility: visible !important; zoom: 1 !important; filter: none; font-size: 14px; line-height: 24px;background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; color: rgb(102, 0, 0); text-align: left; font-weight: bold; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 30px; overflow-x: hidden; overflow-y: hidden; background-position: initial initial; background-repeat: no-repeat no-repeat; "><span class="Apple-style-span" style="color: rgb(51, 51, 51); font-weight: normal; line-height: 18px; font-size: 12px; "><table style="table-layout: fixed; width: 880px; "><tbody><tr><td style="font-family: Arial; word-wrap: break-word; word-break: break-all; visibility: visible !important; zoom: 1 !important; filter: none; font-size: 12px; line-height: 18px; "><div id="blog_text" class="cnt" style="font-family: Arial; word-wrap: break-word; word-break: normal; visibility: visible !important; zoom: 1 !important; filter: none; font-size: 12px !important; line-height: 19px; overflow-x: hidden; overflow-y: hidden; position: static; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 当前版本的sersync依赖于rsync进行同步。如下图所示,在同步主服务器上开启sersync,将监控路径中的文件同步到目标服务器,因此需要在主服务器配置sersync,在同步目标服务器配置rsync。对于rsync配置,在google上可以找到很多资料,以下只是一些必要的配置和使用说明,仅供参考,<span class="Apple-style-span" style="border-collapse: separate; color: rgb(51, 51, 51); ">请根据您的实际情况修改</span><br style="line-height: normal; "><br style="line-height: normal; "><br style="line-height: normal; "><img src="http://www.gaojinbo.com/wp-content/uploads/2010/06/image_thumb2.png" border="0"> <br>如图所示,需要在同步主服务器上配置sersync,在同步目标服务器配置rsync,并在目标服务器开启rsync守候进程,这样在主服务器产生的文件,就会被sersync实时同步到多个目标服务器。在centos系统下默认已经安装了rsync,只需进行配置,并开启rsync守候进程即可。<br style="line-height: normal; "><br style="line-height: normal; "><font size="4" style="line-height: normal; "><strong style="line-height: normal; ">配置同步目标服务器rsync</strong></font><br style="line-height: normal; ">在多台目标服务器上配置如下:<br style="line-height: normal; "><br style="line-height: normal; "><strong style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; background-color: rgb(255, 255, 255); "><font size="3" style="line-height: normal; ">vi /etc/rsyncd.conf</font></span></strong><br style="line-height: normal; "><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">01</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">uid</span><span style="line-height: normal; font-size: 12px !important; color: rgb(0, 0, 0); ">=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">root</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">02</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">gid</span><span style="line-height: normal; font-size: 12px !important; color: rgb(0, 0, 0); ">=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">root</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">03</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">max connections</span><span style="line-height: normal; font-size: 12px !important; color: rgb(0, 0, 0); ">=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">36000</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">04</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">use chroot</span><span style="line-height: normal; font-size: 12px !important; color: rgb(0, 0, 0); ">=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">no</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(248, 16, 176); ">05</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">log file</span><span style="line-height: normal; font-size: 12px !important; color: rgb(0, 0, 0); ">=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">/var/log/rsyncd.log</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">06</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">pid file</span><span style="line-height: normal; font-size: 12px !important; color: rgb(0, 0, 0); ">=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">/var/run/rsyncd.pid</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">07</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">lock file</span><span style="line-height: normal; font-size: 12px !important; color: rgb(0, 0, 0); ">=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">/var/run/rsyncd.lock</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">08</span>&nbsp;<br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">09</span>&nbsp;<br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(248, 16, 176); ">10</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(0, 0, 170); "></span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">11</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">path</span><span style="line-height: normal; font-size: 12px !important; color: rgb(0, 0, 0); ">=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">/opt/tongbu1</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">12</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">comment</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(0, 0, 0); ">=</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">xoyo video files</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">13</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">ignore errors</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(0, 0, 0); ">=</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">yes</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">14</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">read only</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(0, 0, 0); ">=</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">no</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(248, 16, 176); ">15</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">hosts allow</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(0, 0, 0); ">=</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">192.168.0.100/24</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">16</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">hosts deny</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(0, 0, 0); ">=</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">*<br style="line-height: normal; "><br style="line-height: normal; "></span>&nbsp;&nbsp;&nbsp; 上面配置文件,表明允许主服务器(<span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">假设ip为192.168.0.100</span>)访问,rsync同步模块名为<span style="line-height: normal; font-size: 12px !important; color: rgb(0, 0, 170); "></span>,将同步过来的文件放入path指定的目录<span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">/opt/tongbu1</span>。<br style="line-height: normal; ">如果有多台从服务器,则每一台都需要进行类似的配置。<br style="line-height: normal; ">配置好之后,使用如下命令,开启rsync守护进程:<br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; background-color: rgb(207, 226, 243); "><br style="line-height: normal; "><strong style="line-height: normal; "><font size="3" style="line-height: normal; background-color: rgb(255, 255, 255); ">rsync --daemon</font></strong></span><br style="line-height: normal; "><font size="4" color="#000000" style="line-height: normal; "><strong style="line-height: normal; "><br style="line-height: normal; ">在主服务器上安装配置sresync</strong></font><br style="line-height: normal; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(77, 75, 76); line-height: 18px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; font-size: 13px; "><strong style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; text-decoration: none; "><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; text-decoration: none; display: inline !important; ">下载地址:<a title="http://code.google.com/p/sersync/" href="http://code.google.com/p/sersync/" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; text-decoration: none; color: rgb(0, 102, 102); border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; ">http://code.google.com/p/sersync/</a>,建议下载最新版</p></strong></span>。<br style="line-height: normal; "><br style="line-height: normal; "><strong style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; background-color: rgb(255, 255, 255); "><font size="3" style="line-height: normal; ">tar -zxvf sersyncXxxx_xxbit_binary.tar.gz</font></span><font size="3" style="line-height: normal; background-color: rgb(255, 255, 255); "><br style="line-height: normal; "><br style="line-height: normal; ">cd GNU-Linux-x86/<br style="line-height: normal; "><br style="line-height: normal; "></font></strong><span style="line-height: normal; font-size: 12px !important; background-color: rgb(207, 226, 243); "><strong style="line-height: normal; "><font size="3" style="line-height: normal; background-color: rgb(255, 255, 255); ">vi confxml.xml</font></strong><br style="line-height: normal; "><br style="line-height: normal; "></span>修改如下部分:<br style="line-height: normal; "><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">1</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;sersync&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">2</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;localpath</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">watch=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"/opt/tongbu"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">3</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;remote</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">ip=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"192.168.0.104"</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">name=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"tongbu1"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">/&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">4</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;remote</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">ip=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"192.168.0.105"</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">name=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"tongbu1"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">/&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(248, 16, 176); ">5</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;/localpath&gt;</span><br style="line-height: normal; "><br style="line-height: normal; ">表明要将主服务器上本地的<span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">/opt/tongbu&nbsp;<font color="#000000" style="line-height: normal; ">路径下的文件,同步到远程服务器</font></span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">192.168.0.104<font color="#000000" style="line-height: normal; "><font bgcolor="#000000" style="line-height: normal; ">&nbsp;与&nbsp;</font></font></span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">192.168.0.105</span>上的<span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">tongbu1&nbsp;<font color="#000000" style="line-height: normal; ">模块</font></span>。<br style="line-height: normal; "><br style="line-height: normal; "><strong style="line-height: normal; "><font size="4" style="line-height: normal; ">运行Sersync与Sersync启动参数</font></strong><br style="line-height: normal; ">sersync会对目录进行监控,将变化的目录或文件同步到远程服务器。sersync是递归监控的,如果有多级目录,都会同步到远程服务器。常用启动方式如下:<br style="line-height: normal; "><font color="#00ff00" style="line-height: normal; "><strong style="line-height: normal; "><em style="line-height: normal; "><br style="line-height: normal; "></em><font size="3" color="#3d85c6" style="line-height: normal; ">1.在主服务器上开启sersync<font face="宋体" style="line-height: normal; ">守护进程</font>,使sersync在后台运行,开启实时同步。</font></strong></font><font size="3" style="line-height: normal; "><strong style="line-height: normal; "><font color="#00ff00" style="line-height: normal; "><br style="line-height: normal; "><font color="#000000" style="line-height: normal; background-color: rgb(255, 255, 255); ">./sersync -d</font></font><br style="line-height: normal; "></strong></font><br style="line-height: normal; ">过程如下:<br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(0, 0, 0); ">[</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 0, 0); ">root@localhost GNU-Linux-x86</span><span style="line-height: normal; font-size: 12px !important; color: rgb(0, 0, 0); ">]</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">#&nbsp;<strong style="line-height: normal; "><font color="#000000" style="line-height: normal; ">ls</font></strong></span><br style="line-height: normal; "><div class="source" style="font-family: Arial; word-wrap: break-word; word-break: break-all; visibility: visible !important; zoom: 1 !important; filter: none; font-size: 12px !important; line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(0, 0, 0); ">confxml.xml&nbsp; sersync2</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(0, 0, 0); "># ./sersync2</span>&nbsp;-d<br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(0, 0, 0); ">set the system param</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(0, 0, 0); ">execute:echo 50000000 &gt; /proc/sys/fs/inotify/max_user_watches</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(0, 0, 0); ">execute:echo 327679 &gt; /proc/sys/fs/inotify/max_queued_events</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(0, 0, 0); ">parse the command param</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(0, 0, 0); ">daemon thread num</span><span style="line-height: normal; font-size: 12px !important; color: rgb(0, 0, 0); ">:</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(0, 0, 0); ">10</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(0, 0, 0); ">parse xml config file</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(0, 0, 0); ">host ip</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(0, 0, 0); ">:</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(0, 0, 0); ">localhost&nbsp;&nbsp;&nbsp;&nbsp; host port</span><span style="line-height: normal; font-size: 12px !important; color: rgb(0, 0, 0); ">:</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(0, 0, 0); ">8008</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(0, 0, 0); ">config xml parse success</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(0, 0, 0); ">please set /etc/rsyncd.conf max connections=0 Manually</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(0, 0, 0); ">sersync working thread 12&nbsp; = 1(primary thread) + 1(fail retry thread) + 10(daemon sub threads)</span>&nbsp;<br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(0, 0, 0); ">please according your cpu ,use -n param to adjust the cpu rate</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(0, 0, 0); ">run the sersync</span><span style="line-height: normal; font-size: 12px !important; color: rgb(0, 0, 0); ">:</span>&nbsp;<br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(0, 0, 0); ">watch path is</span><span style="line-height: normal; font-size: 12px !important; color: rgb(0, 0, 0); ">:</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(0, 0, 0); ">/opt/tongbu</span></div>表明,sersync已经开启,可以在本地监控路径下建立文件,查看远程是否同步成功。<br style="line-height: normal; "><font color="#00ff00" style="line-height: normal; "><em style="line-height: normal; "><strong style="line-height: normal; "><br style="line-height: normal; "></strong></em></font><font size="3" face="宋体" color="#00ff00" style="line-height: normal; "><strong style="line-height: normal; "><font color="#3d85c6" style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; background-color: rgb(255, 255, 255); ">2.</span></font><font color="#3d85c6" style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; background-color: rgb(255, 255, 255); ">在开启实时监控的之前对主服务器目录与远程目标机目录进行一次整体同步</span></font></strong></font><br style="line-height: normal; "><font color="#00ff00" style="line-height: normal; "><strong style="line-height: normal; "><font size="3" style="line-height: normal; "><font color="#000000" style="line-height: normal; background-color: rgb(255, 255, 255); ">./sersync -r</font></font></strong></font><br style="line-height: normal; "><br style="line-height: normal; ">如果需要将sersync运行前,已经存在的所有文件或目录全部同步到远程,要以-r参数运行sersync,将本地与远程整体同步一次。<br style="line-height: normal; ">如果设置了过滤器,即在xml文件中,filter为true,则暂时不能使用-r参数进行整体同步。-r参数将会无效<br style="line-height: normal; "><strong style="line-height: normal; "><font color="#00ff00" style="line-height: normal; "><em style="line-height: normal; "><br style="line-height: normal; "></em></font><font size="3" face="宋体" color="#00ff00" style="line-height: normal; "><font color="#3d85c6" style="line-height: normal; background-color: rgb(255, 255, 255); ">3.</font><font color="#3d85c6" style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; background-color: rgb(255, 255, 255); ">查看启动参数帮助</span></font></font></strong><strong style="line-height: normal; "><font color="#00ff00" style="line-height: normal; "><font size="3" style="line-height: normal; "><br style="line-height: normal; "><font color="#000000" style="line-height: normal; background-color: rgb(255, 255, 255); ">./sersync --help</font></font></font></strong><br style="line-height: normal; "><font color="#00ff00" style="line-height: normal; "><strong style="line-height: normal; "><br style="line-height: normal; "><font size="3" style="line-height: normal; "><font color="#3d85c6" style="line-height: normal; ">4.指定配置文件</font><br style="line-height: normal; "><font color="#000000" style="line-height: normal; background-color: rgb(255, 255, 255); ">./sersync -o XXXX.xml</font></font></strong><br style="line-height: normal; "></font>对于sersync使用可执行文件目录下的默认配置文件confxml.xml,如果需要使用另一个配置文件,可以使用-o参数指定其它配置文件。<br style="line-height: normal; "><font color="#00ff00" style="line-height: normal; "><em style="line-height: normal; "><br style="line-height: normal; "></em><strong style="line-height: normal; "><font size="3" style="line-height: normal; "><font size="3" color="#3d85c6" style="line-height: normal; ">5.指定默认的线程池的线程总数</font><br style="line-height: normal; "><font color="#000000" style="line-height: normal; background-color: rgb(255, 255, 255); ">./sersync -n num</font></font><br style="line-height: normal; "></strong></font>例如 ./sersync -n 5 则指定线程总数为5,如果不指定,默认启动线程池数量是10,如果cpu使用过高,可以通过这个参数调低,如果机器配置较高,可以用-n跳高线程总数。<br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); "><br style="line-height: normal; "><strong style="line-height: normal; "><font color="#00ff00" style="line-height: normal; "><font size="3" style="line-height: normal; "><font color="#3d85c6" style="line-height: normal; ">6.不进行同步,只运行插件</font><br style="line-height: normal; "><font color="#000000" style="line-height: normal; background-color: rgb(255, 255, 255); ">./sersync -m pluginName</font></font></font></strong><em style="line-height: normal; "><strong style="line-height: normal; "><font color="#00ff00" style="line-height: normal; "><br style="line-height: normal; "></font></strong></em><font color="#000000" style="line-height: normal; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 例如./sersync -m command,则在监控到文件事件后,不对远程目标服务器进行同步,而是直接运行command插件。<br style="line-height: normal; "><br style="line-height: normal; "><font size="3" color="#00ff00" style="line-height: normal; "><strong style="line-height: normal; "><font color="#3d85c6" style="line-height: normal; ">7.多个参数可以配合使用</font><br style="line-height: normal; "><font color="#000000" style="line-height: normal; background-color: rgb(255, 255, 255); ">./sersync -n 8 -o abc.xml -r -d</font></strong></font><br style="line-height: normal; ">表示,设置线程池工作线程为8个,指定abc.xml作为配置文件,在实时监控前作一次整体同步,以守护进程方式在后台运行。<br style="line-height: normal; "><br style="line-height: normal; "><font color="#3d85c6" style="line-height: normal; "><strong style="line-height: normal; "><font size="3" style="line-height: normal; ">8.通常情况下,</font></strong></font></font></span><font color="#3d85c6" style="line-height: normal; "><strong style="line-height: normal; "><font size="3" style="line-height: normal; ">对本地到远程整体同步一遍后,在后台运行实时同步。</font></strong></font><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); "><font color="#000000" style="line-height: normal; "><font size="3" color="#00ff00" style="line-height: normal; "><strong style="line-height: normal; "><font color="#000000" style="line-height: normal; background-color: rgb(255, 255, 255); ">./sersync -r -d</font></strong></font></font></span></div></td></tr></tbody></table></span></div></span>

dirtysea 发表于 2010-6-30 13:54:40

<span class="Apple-style-span" style="color: rgb(51, 51, 51); font-family: Arial; line-height: 18px; font-size: 12px; "><div class="tit" style="font-family: Arial; word-wrap: break-word; word-break: break-all; visibility: visible !important; zoom: 1 !important; filter: none; font-size: 14px; line-height: 24px; background-image: url(http://imgsrc.baidu.com/css/pic/item/9d167918208f193234fa4169.jpg); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; color: rgb(102, 0, 0); text-align: left; font-weight: bold; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 30px; overflow-x: hidden; overflow-y: hidden; background-position: initial initial; background-repeat: no-repeat no-repeat; ">sersync2 完全安装配置说明(二) ----可选功能与xml高级配置</div><div class="date" style="font-family: Arial; word-wrap: break-word; word-break: break-all; visibility: visible !important; zoom: 1 !important; filter: none; font-size: 12px; line-height: 18px; color: rgb(119, 119, 119) !important; text-align: left; margin-top: 5px; margin-right: 0px; margin-bottom: 7px; margin-left: 0px; ">2010-06-05 22:08</div><table style="table-layout: fixed; width: 880px; "><tbody><tr><td style="font-family: Arial; word-wrap: break-word; word-break: break-all; visibility: visible !important; zoom: 1 !important; filter: none; font-size: 12px; line-height: 18px; "><div id="blog_text" class="cnt" style="font-family: Arial; word-wrap: break-word; word-break: normal; visibility: visible !important; zoom: 1 !important; filter: none; font-size: 12px !important; line-height: 19px; overflow-x: hidden; overflow-y: hidden; position: static; "><strong style="line-height: normal; "><font size="4" style="line-height: normal; ">XML配置说明</font></strong><br style="line-height: normal; "><br style="line-height: normal; ">sersync可选功能是通过xml配置文件来实现的,基本配置文件如下:<br style="line-height: normal; ">——————————————————————————————————————————————<br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">01</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(76, 131, 23); ">&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">02</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;head</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">version=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"2.5"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">03</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;host</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">hostip=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"localhost"</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">port=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"8008"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&gt;&lt;/host&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">04</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;filter</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">start=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"false"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(248, 16, 176); ">05</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;exclude</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">expression=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"(.*)\.gz"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&gt;&lt;/exclude&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">06</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;exclude</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">expression=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"^info/*"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&gt;&lt;/exclude&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">07</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;/filter&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">08</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;inotify&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">09</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;delete</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">start=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"true"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">/&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(248, 16, 176); ">10</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;createFolder</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">start=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"true"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">/&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">&nbsp;&nbsp;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;createFile</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">start=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"true"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">/&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">11</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;/inotify&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">12</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;debug</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">start=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"false"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">/&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">13</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;sersync&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">14</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;localpath</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">watch=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"/opt/tongbu"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(248, 16, 176); ">15</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;remote</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">ip=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"192.168.0.104"</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">name=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"tongbu1"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">/&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">16</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">&lt;!--&lt;remote ip="192.168.8.39" name="tongbu"/&gt;--&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">17</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">&lt;!--&lt;remote ip="192.168.8.40" name="tongbu"/&gt;--&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">18</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;/localpath&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">19</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;rsync&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">20 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;commonParams params="-artuz</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">/&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(248, 16, 176); ">20</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;auth</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">start=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"false"</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">users=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"root"</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">passwordfile=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"/etc/rsync.pas"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">/&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">21</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;userDefinedPort</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">start=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"false"</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">port=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"874"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">/&gt;</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">&lt;!-- port=874 --&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">22</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;timeout</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">start=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"false"</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">time=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"100"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">/&gt;</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">&lt;!-- timeout=100 --&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">23</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;ssh</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">start=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"false"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">/&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">24</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;/rsync&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(248, 16, 176); ">25</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;failLog</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">path=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"/tmp/rsync_fail_log.sh"</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">timeToExecute=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"60"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">/&gt;</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">&lt;!--default every 60min execute once--&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">26</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;crontab</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">start=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"false"</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">schedule=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"600"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&gt;</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">&lt;!--600mins--&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">27</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;crontabfilter</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">start=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"false"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">28</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;exclude</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">expression=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"*.gz"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&gt;&lt;/exclude&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">29</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;exclude</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">expression=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"info/*"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&gt;&lt;/exclude&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(248, 16, 176); ">30</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;/crontabfilter&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">31</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;/crontab&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">32</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;plugin</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">start=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"false"</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">name=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"command"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">/&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">33</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;/sersync&gt;</span><br style="line-height: normal; ">——————————————————————————————————————————————<br style="line-height: normal; "><br style="line-height: normal; ">下面做逐行的进行解释说明:<br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">03</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;host</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">hostip=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"localhost"</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">port=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"8008"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&gt;&lt;/host&gt;</span><br style="line-height: normal; ">hostip与port是针对插件的保留字段,对于同步功能没有任何作用,保留默认即可。<br style="line-height: normal; "><font size="4" style="line-height: normal; "><strong style="line-height: normal; "><br style="line-height: normal; ">filter文件过滤功能</strong></font><br style="line-height: normal; ">对于sersync监控的文件,会默认过滤系统的临时文件(以“.”开头,以“~”结尾),除了这些文件外,可以自定义其他需要过滤的文件。<br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">04</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;filter</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">start=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"true"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(248, 16, 176); ">05</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;exclude</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">expression=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"(.*)\.gz"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&gt;&lt;/exclude&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">06</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;exclude</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">expression=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"^info/*"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&gt;&lt;/exclude&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">07</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;/filter&gt;</span><br style="line-height: normal; ">将<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">start</span>设置为&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">true</span>,在exclude标签中,填写正则表达式,默认给出两个例子分别是过滤以".gz"结尾的文件与过滤监控目录下的info路径(监控路径/info/*),可以根据需要添加,但开启的时候,自己测试一下,正则表达式如果出现错误,控制台会有提示。相比较使用rsync 的exclude功能,被过滤的路径,不会加入监控,大大减少rsync的通讯量。<br style="line-height: normal; "><font size="4" style="line-height: normal; "><strong style="line-height: normal; "><br style="line-height: normal; ">inotify监控参数设定</strong></font>(优化)<br style="line-height: normal; ">对于inotify监控参数可以进行设置,根据您项目的特点优化srsync。<br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">08</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;inotify&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">09</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;delete</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">start=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"true"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">/&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(248, 16, 176); ">10</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;createFolder</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">start=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"true"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">/&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">1</span>1 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;createFile</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">start=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"true"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">/&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">12</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;/inotify&gt;</span><br style="line-height: normal; "><font color="#0b5394" style="line-height: normal; ">对于大多数应用,可以尝试把<strong style="line-height: normal; ">createFile</strong>(监控文件事件选项)设置为false来提高性能,减少 rsync通讯。因为拷贝文件到监控目录会产生create事件与close_write事件,所以如果关闭create事件,只监控文件拷贝结束时的事 件close_write,同样可以实现文件完整同步。</font><br style="line-height: normal; "><font color="#000000" style="line-height: normal; "><strong style="line-height: normal; ">注意:强将</strong></font><font color="#000000" style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">createFolder保持为true,</span></font><font color="#000000" style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">如果将createFolder</span>设为false,则不会对产生的目录进行监控,该目录下的子文件与子目录也不会被监控。</font>所以除非特殊需要,请开启。<br style="line-height: normal; ">默认情况下对创建文件(目录)事件与删除文件(目录)事件都进行监控,如果项目中不需要删除远程目标服务器的文件(目录),则可以将<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">delete</span>&nbsp;参数设置为false,则不对删除事件进行监控。<br style="line-height: normal; "><br style="line-height: normal; "><font color="#0b5394" style="line-height: normal; "><br style="line-height: normal; "></font><br style="line-height: normal; "><br style="line-height: normal; "><br style="line-height: normal; "><strong style="line-height: normal; "><font size="4" style="line-height: normal; ">Debug开启</font></strong><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">12</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;debug</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">start=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"false"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">/&gt;</span><br style="line-height: normal; ">设置为true,开启debug模式,会在sersync正在运行的控制台,打印inotify事件与rsync同步命令。<br style="line-height: normal; "><font size="3" style="line-height: normal; "><strong style="line-height: normal; "><br style="line-height: normal; "><font size="4" style="line-height: normal; ">XFS文件系统</font></strong></font><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;fileSystem</span>&nbsp;xfs<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"false"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">/&gt;</span><br style="line-height: normal; ">对于xfs文件系统的用户,需要将这个选项开启,才能使sersync正常工作<br style="line-height: normal; "><br style="line-height: normal; "><strong style="line-height: normal; "><font size="4" style="line-height: normal; "><br style="line-height: normal; ">文件监控与远程同步设置</font></strong><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">3</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;sersync&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">14</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;localpath</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">watch=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"/opt/tongbu"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(248, 16, 176); ">15</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;remote</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">ip=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">192.168.0.104</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">name=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"tongbu1"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">/&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">16</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">&lt;!--&lt;remote ip="192.168.8.39" name="tongbu"/&gt;--&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">17</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">&lt;!--&lt;remote ip="192.168.8.40" name="tongbu"/&gt;--&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">18</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;/localpath&gt;<br style="line-height: normal; "><font color="#000000" style="line-height: normal; ">详见</font></span><a target="_blank" href="http://hi.baidu.com/johntech/blog/item/be8559d2ebc99282a1ec9c18.html" style="color: rgb(102, 0, 0); text-decoration: none; line-height: normal; ">sersync2 完全安装配置说明(一) ----基本功能使用</a><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; "><br style="line-height: normal; "><font color="#000000" style="line-height: normal; "><strong style="line-height: normal; "><font size="4" style="line-height: normal; "><br style="line-height: normal; ">Rsync参数配置<br style="line-height: normal; "></font></strong></font></span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">19</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;rsync&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">20 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;commonParams params="-artuz</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">/&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(248, 16, 176); ">20</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;auth</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">start=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"false"</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">users=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"root"</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">passwordfile=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"/etc/rsync.pas"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">/&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">21</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;userDefinedPort</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">start=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"false"</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">port=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"874"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">/&gt;</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">&lt;!-- port=874 --&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">22</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;timeout</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">start=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"false"</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">time=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"100"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">/&gt;</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">&lt;!-- timeout=100 --&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">23</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;ssh</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">start=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"false"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">/&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">24</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;/rsync&gt;<br style="line-height: normal; "></span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">commonParams可以用户自定义rsync参数,默认是-artuz</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">auth</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">start=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"false"</span>&nbsp;设置为true的时候,使用rsync的认证模式传送,需要配置user与passwrodfile(--password-file=/etc/rsync.pas),来使用。<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">userDefinedPort&nbsp;&nbsp;</span>当远程同步目标服务器的rsync端口不是默认端口的时候使用(--port=874)。<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">timeout</span>设置rsync的timeout时间(--timeout=100)。<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">ssh&nbsp;</span>使用rsync -e ssh的方式进行传输。<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; "><font color="#000000" style="line-height: normal; "><strong style="line-height: normal; "><font size="4" style="line-height: normal; "><br style="line-height: normal; "><br style="line-height: normal; ">失败日志脚步配置<br style="line-height: normal; "></font></strong></font></span><span style="line-height: normal; font-size: 12px !important; color: rgb(248, 16, 176); ">25</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;failLog</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">path=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"/tmp/rsync_fail_log.sh"</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">timeToExecute=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"60"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">/&gt;</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">&lt;!--default every 60min&nbsp;</span><br style="line-height: normal; ">对于失败的传输,会进行重新传送,再次失败就会写入rsync_fail_log,然后每隔一段时间(<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">timeToExecute进行设置</span>)执行该脚本再次重新传送,然后清空该脚本。可以通过<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">path</span>来设置日志路径。<br style="line-height: normal; "><br style="line-height: normal; "><font size="4" style="line-height: normal; "><strong style="line-height: normal; ">Crontab定期整体同步功能</strong></font><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">26</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;crontab</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">start=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"false"</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">schedule=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"600"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&gt;</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">&lt;!--600mins--&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">27</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;crontabfilter</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">start=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"false"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">28</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;exclude</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">expression=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"*.gz"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&gt;&lt;/exclude&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">29</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;exclude</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">expression=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"info/*"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&gt;&lt;/exclude&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(248, 16, 176); ">30</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;/crontabfilter&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">31</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;/crontab&gt;</span><br style="line-height: normal; ">crontab可以对监控路径与远程目标主机每隔一段时间进行一次整体同步,可能由于一些原因两次失败重传都失败了,这个时候如果开启了crontab功能,还可以进一步保证各个服务器文件一致,如果文件量比较大,crontab的时间间隔要设的大一些,否则可能增加通讯开销。<font color="#000000" style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">schedule这个参数是设置crontab的时间间隔,默认是600分钟</span></font><br style="line-height: normal; ">如果开启了filter文件过滤功能,那么crontab整体同步也需要设置过滤,否则虽然实时同步的时候文件被过滤了,但crontab整体同步的时候如果不单独设置crontabfilter,还会将需过滤的文件同步到远程,crontab的过滤正则与filter过滤的不同,也给出了两个实例分别对应与过滤文件与目录。总之如果同时开启了filter与crontab,则要开启crontab的<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">crontabfilter</span>,并按示例设置使其与filter的过滤一一对应。<br style="line-height: normal; "><br style="line-height: normal; "><font size="4" style="line-height: normal; ">插件设置</font><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 170, 170); font-style: italic; ">32</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;plugin</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">start=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"false"</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">name=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"command"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">/&gt;</span><br style="line-height: normal; ">当设置为true的时候,将文件同步到远程服务器后会调用name参数指定的插件。详见请看<br style="line-height: normal; ">插件设置。</div></td></tr></tbody></table></span>

dirtysea 发表于 2010-6-30 13:58:54

<span class="Apple-style-span" style="color: rgb(51, 51, 51); font-family: Arial; line-height: 18px; font-size: 12px; "><div class="tit" style="font-family: Arial; word-wrap: break-word; word-break: break-all; visibility: visible !important; zoom: 1 !important; filter: none; font-size: 14px; line-height: 24px; background-image: url(http://imgsrc.baidu.com/css/pic/item/9d167918208f193234fa4169.jpg); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; color: rgb(102, 0, 0); text-align: left; font-weight: bold; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 30px; overflow-x: hidden; overflow-y: hidden; background-position: initial initial; background-repeat: no-repeat no-repeat; ">sersync2 完全安装配置说明(三) ----插件基本配置和使用</div><div class="date" style="font-family: Arial; word-wrap: break-word; word-break: break-all; visibility: visible !important; zoom: 1 !important; filter: none; font-size: 12px; line-height: 18px; color: rgb(119, 119, 119) !important; text-align: left; margin-top: 5px; margin-right: 0px; margin-bottom: 7px; margin-left: 0px; ">2010-06-06 00:53</div><table style="table-layout: fixed; width: 880px; "><tbody><tr><td style="font-family: Arial; word-wrap: break-word; word-break: break-all; visibility: visible !important; zoom: 1 !important; filter: none; font-size: 12px; line-height: 18px; "><div id="blog_text" class="cnt" style="font-family: Arial; word-wrap: break-word; word-break: normal; visibility: visible !important; zoom: 1 !important; filter: none; font-size: 12px !important; line-height: 19px; overflow-x: hidden; overflow-y: hidden; position: static; "><h4 style="line-height: normal; text-align: justify; "><font size="4" style="line-height: normal; "><strong style="line-height: normal; ">插件相关xml</strong></font></h4><h4 style="line-height: normal; text-align: justify; "><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;sersync&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(0, 0, 0); ">......&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;plugin</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">start=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"false"</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">name=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"command"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">/&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;/sersync&gt;</span><br style="line-height: normal; "><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;plugin</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">name=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"command"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;param</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">prefix=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"/bin/sh"</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">suffix=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">""</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">ignoreError=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"true"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">/&gt;</span>&nbsp;&nbsp;<br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;filter</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">start=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"false"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;include</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">expression=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"(.*)\.php"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">/&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;include</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">expression=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"(.*)\.sh"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">/&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;/filter&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;/plugin&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;plugin</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">name=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"socket"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;localpath</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">watch=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"/opt/tongbu"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;deshost</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">ip=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"192.168.138.20"</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">port=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"8009"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">/&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;/localpath&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;/plugin&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;plugin</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">name=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"refreshCDN"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;localpath</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">watch=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"/data0/htdocs/cms.xoyo.com/site/"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;cdninfo</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">domainname=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"ccms.chinacache.com"</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">port=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"80"</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">username=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"xxxx"</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">passwd=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"xxxx"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">/&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;sendurl</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">base=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"http://pic.xoyo.com/cms"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">/&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;regexurl</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">regex=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"false"</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">match=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"cms.xoyo.com/site(*).xoyo.com/images"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">/&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;/localpath&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;/plugin&gt;</span></h4><p class="0" style="line-height: normal; font-size: 12px !important; text-indent: 21pt; text-align: justify; "><span style="line-height: normal; font-size: 12px !important; "><font face="宋体" style="line-height: normal; ">如 上面的xml所示,其中plugin标签设置为true时候,在同步文件或路径到远程之后后,调用插件。通过name参数指定需要执行的插件。</font></span><span style="line-height: normal; font-size: 12px !important; "><font face="宋体" style="line-height: normal; ">目前支持的有command refreshCDN&nbsp;socket&nbsp;http四种插件。http插件目前由于兼容性原因去除,以后会重新加入。</font></span></p><h4 style="line-height: normal; text-align: justify; "><font size="4" style="line-height: normal; "><strong style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; "><font face="宋体" style="line-height: normal; ">command插件</font></span></strong></font></h4>当文件同步完成后,会调用command插件,如同步文件是test.php,则test.php文件在改动之后,调用rsync同步到远程服务器后,调用command插件,执行<br style="line-height: normal; "><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; background-color: rgb(208, 224, 227); ">/bin/sh test.php&nbsp;&nbsp;</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); "><font color="#000000" style="line-height: normal; background-color: rgb(208, 224, 227); ">suffix</font><span style="line-height: normal; font-size: 12px !important; background-color: rgb(208, 224, 227); ">&nbsp;</span><font color="#000000" style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; background-color: rgb(208, 224, 227); ">&gt;/dev/null 2&gt;&amp;1&nbsp;</span><br style="line-height: normal; "><br style="line-height: normal; ">如果</font></span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">suffix</span>&nbsp;设置了,则会放在inotify事件test.php之后<br style="line-height: normal; ">如果<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">ignoreError</span>为true,则会添加<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); "><font color="#000000" style="line-height: normal; ">&gt;/dev/null 2&gt;&amp;1<br style="line-height: normal; ">当然还可以设置command的filter,当filter为ture,include可以只对正则匹配到的文件,调用command。<br style="line-height: normal; "></font></span><p class="0" style="line-height: normal; font-size: 12px !important; text-indent: 21pt; text-align: justify; "></p><h3 style="line-height: normal; text-align: justify; "><span style="line-height: normal; font-size: 12px !important; "><font face="宋体" style="line-height: normal; ">刷新CDN插件</font></span></h3><span style="line-height: normal; font-size: 12px !important; "><font face="宋体" style="line-height: normal; ">“refreshCDN”,就在同步过程中将文件发送到目 的服务器后刷新cdn接口。如果不想使用,则将start属性设为false即可。如果需要使用其他插件,则查看其他plugin标签,将插件名称改为 xml中其它插件的名称即可。</font></span><br style="line-height: normal; "><br style="line-height: normal; "><p class="0" style="line-height: normal; font-size: 12px !important; text-align: justify; "><span style="line-height: normal; font-size: 12px !important; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font face="宋体" style="line-height: normal; ">以下模块(refreshCDN http socket)可以单独使用,只需在命令行下使用-m&nbsp;参数即可。如果需要作为插件与同步程序一起使用,见同步程序说明的插件配置。</font></span></p><p class="0" style="line-height: normal; font-size: 12px !important; background-image: none; background-attachment: scroll; background-origin: initial; background-clip: initial; background-color: rgb(255, 255, 255); margin-left: 2.5pt; margin-right: 2.5pt; text-align: justify; background-position: 0% 0%; background-repeat: repeat repeat; "><span style="line-height: normal; font-size: 12px !important; "><font face="宋体" style="line-height: normal; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 该模块根据chinaCDN的协议,进行设计,当有文件产生的时候,就向cdn接口发送需要刷新的路径位置。刷新CDN模块需要配置的xml文件如下。</font></span></p><p class="0" style="line-height: normal; font-size: 12px !important; background-image: none; background-attachment: scroll; background-origin: initial; background-clip: initial; background-color: rgb(255, 255, 255); margin-left: 2.5pt; margin-right: 2.5pt; text-align: justify; background-position: 0% 0%; background-repeat: repeat repeat; ">&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;plugin</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">name=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"refreshCDN"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&gt;</span></p><h4 style="line-height: normal; text-align: justify; "><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;localpath</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">watch=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"/data0/htdocs/cms.xoyo.com/site/"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;cdninfo</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">domainname=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"ccms.chinacache.com"</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">port=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"80"</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">username=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"xxxx"</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">passwd=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"xxxx"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">/&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;sendurl</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">base=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"http://pic.xoyo.com/cms"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">/&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;regexurl</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">regex=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"false"</span>&nbsp;<span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); ">match=</span><span style="line-height: normal; font-size: 12px !important; color: rgb(170, 85, 0); ">"cms.xoyo.com/site(*).xoyo.com/images"</span><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">/&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;/localpath&gt;</span><br style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; color: rgb(30, 144, 255); font-weight: bold; ">&lt;/plugin&gt;</span></h4><p class="0" style="line-height: normal; font-size: 12px !important; text-align: justify; "></p><p class="0" style="line-height: normal; font-size: 12px !important; text-align: justify; "><span style="line-height: normal; font-size: 12px !important; "><font face="宋体" style="line-height: normal; ">其中&nbsp;localpath&nbsp;watch&nbsp;是需要监控的目录。</font></span></p><p class="0" style="line-height: normal; font-size: 12px !important; text-align: justify; "><span style="line-height: normal; font-size: 12px !important; ">cdnifo<font face="宋体" style="line-height: normal; ">标签制定了cdn接口的域名,端口号,以及用户名与密码。</font></span></p><p class="0" style="line-height: normal; font-size: 12px !important; text-align: justify; "><span style="line-height: normal; font-size: 12px !important; ">sendurl<font face="宋体" style="line-height: normal; ">标签是需要刷新的url的前缀。</font></span></p><p class="0" style="line-height: normal; font-size: 12px !important; text-align: justify; "><span style="line-height: normal; font-size: 12px !important; ">regexurl<font face="宋体" style="line-height: normal; ">标签中的,regex属性为true时候,使用match属性的正则语句匹配inotify返回的路径信息,并将正则匹配到的部分作为url一部分,</font></span></p><p class="0" style="line-height: normal; font-size: 12px !important; text-align: justify; "><span style="line-height: normal; font-size: 12px !important; "><font face="宋体" style="line-height: normal; ">举例:</font></span></p><p class="0" style="line-height: normal; font-size: 12px !important; text-align: justify; "><span style="line-height: normal; font-size: 12px !important; "><font face="宋体" style="line-height: normal; ">如果产生文件事件为:/data0/htdoc/cms.xoyo.com/site/jx3.xoyo.com/image/a/123.txt</font></span></p><p class="0" style="line-height: normal; font-size: 12px !important; text-align: justify; "><span style="line-height: normal; font-size: 12px !important; "><font face="宋体" style="line-height: normal; ">经过上面的match正则匹配后,最后刷新的路径是:</font></span></p><p class="0" style="line-height: normal; font-size: 12px !important; text-align: justify; "><span style="line-height: normal; font-size: 12px !important; "><a href="http://pic.xoyo.com/cms/jx3/a/123.txt;" style="color: rgb(102, 0, 0); text-decoration: none; line-height: normal; "><span style="line-height: normal; font-size: 12px !important; ">http://pic.xoyo.com/cms/jx3/a/123.txt;</span></a></span></p><p class="0" style="line-height: normal; font-size: 12px !important; text-align: justify; "><span style="line-height: normal; font-size: 12px !important; "><font face="宋体" style="line-height: normal; ">如果regex属性为false,最后刷新的路径是</font></span></p><p class="0" style="line-height: normal; font-size: 12px !important; text-align: justify; "><span style="line-height: normal; font-size: 12px !important; "><a href="http://pic.xoyo.com/cms/jx3/a/123.txt;" style="color: rgb(102, 0, 0); text-decoration: none; line-height: normal; "><span style="line-height: normal; font-size: 12px !important; ">http://pic.xoyo.com/cms/jx3.xoyo.com/images/a/123.txt;</span></a></span></p><p class="0" style="line-height: normal; font-size: 12px !important; text-align: justify; "></p><p class="0" style="line-height: normal; font-size: 12px !important; text-align: justify; "></p><h4 style="line-height: normal; text-align: justify; "><strong style="line-height: normal; "><font size="4" style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; ">socket插件</span></font></strong></h4><p class="0" style="line-height: normal; font-size: 12px !important; text-align: justify; "><span style="line-height: normal; font-size: 12px !important; ">socket<font face="宋体" style="line-height: normal; ">插件,开启该模块,则向指定ip与端口发送inotify所产生的文件路径信息:</font></span></p><p class="0" style="line-height: normal; font-size: 12px !important; text-align: justify; "></p><h4 style="line-height: normal; text-align: justify; "><strong style="line-height: normal; "><font size="4" style="line-height: normal; "><span style="line-height: normal; font-size: 12px !important; ">Http插件</span></font></strong></h4><p class="0" style="line-height: normal; font-size: 12px !important; text-align: justify; "><span style="line-height: normal; font-size: 12px !important; ">http<font face="宋体" style="line-height: normal; ">插件,可以向指定域名的主机post,inotify监控的事件</font></span></p><p class="0" style="line-height: normal; font-size: 12px !important; text-align: justify; "><span style="line-height: normal; font-size: 12px !important; ">其中mask是事件掩膜,8为修改保存,其它inotify事件掩码,见google。</span></p><p class="0" style="line-height: normal; font-size: 12px !important; text-align: justify; "><font size="4" style="line-height: normal; "><strong style="line-height: normal; ">单独运行插件</strong></font></p><p class="0" style="line-height: normal; font-size: 12px !important; text-align: justify; "><span style="line-height: normal; font-size: 12px !important; ">插件也可以单独使用,即不对远程目标机进行同步,直接调用插件:</span></p><p class="0" style="line-height: normal; font-size: 12px !important; text-align: justify; "><span style="line-height: normal; font-size: 12px !important; ">只调用command插件</span></p><p class="0" style="line-height: normal; font-size: 12px !important; text-align: justify; background-color: rgb(207, 226, 243); "><span style="line-height: normal; font-size: 12px !important; ">.</span><span style="line-height: normal; font-size: 12px !important; ">/sersync -d -m command</span></p><p class="0" style="line-height: normal; font-size: 12px !important; text-align: justify; "><span style="line-height: normal; font-size: 12px !important; ">只调用refreshCDN插件</span></p><p class="0" style="line-height: normal; font-size: 12px !important; text-align: justify; background-color: rgb(207, 226, 243); "><span style="line-height: normal; font-size: 12px !important; ">./sersync -d -m refreshCDN</span></p><p class="0" style="line-height: normal; font-size: 12px !important; text-align: justify; "><span style="line-height: normal; font-size: 12px !important; ">只调用socket插件</span></p><p class="0" style="line-height: normal; font-size: 12px !important; text-align: justify; background-color: rgb(207, 226, 243); "><span style="line-height: normal; font-size: 12px !important; ">./sersync -d -m socket</span></p><p class="0" style="line-height: normal; font-size: 12px !important; text-align: justify; background-color: rgb(255, 255, 255); "><span style="line-height: normal; font-size: 12px !important; ">只调用http插件<br style="line-height: normal; "></span></p><p class="0" style="line-height: normal; font-size: 12px !important; background-image: none; background-attachment: scroll; background-origin: initial; background-clip: initial; background-color: rgb(207, 226, 243); margin-right: 2.5pt; text-align: justify; background-position: 0% 0%; background-repeat: repeat repeat; "><span style="line-height: normal; font-size: 12px !important; ">./sersync&nbsp;-d&nbsp;-m&nbsp;http</span></p><div><span style="line-height: normal; font-size: 12px !important; "><br></span></div></div></td></tr></tbody></table></span>
页: [1]
查看完整版本: 金山逍遥网sersync服务器实时镜像、自动同步开源程序