{"id":475,"date":"2024-04-17T16:14:50","date_gmt":"2024-04-17T08:14:50","guid":{"rendered":"http:\/\/8.141.4.74\/?p=475"},"modified":"2024-04-17T16:14:50","modified_gmt":"2024-04-17T08:14:50","slug":"sersync-%e5%ae%9e%e7%8e%b0%e5%ae%9e%e6%97%b6%e6%95%b0%e6%8d%ae%e5%90%8c%e6%ad%a5","status":"publish","type":"post","link":"http:\/\/8.141.4.74\/?p=475","title":{"rendered":"sersync \u5b9e\u73b0\u5b9e\u65f6\u6570\u636e\u540c\u6b65"},"content":{"rendered":"<p><code>sersync<\/code> \u662f\u4e00\u79cd\u57fa\u4e8e Linux \u7684\u5f00\u6e90\u5de5\u5177\uff0c\u4e3b\u8981\u7528\u4e8e\u5b9e\u65f6\u540c\u6b65\u6587\u4ef6\u548c\u6587\u4ef6\u5939\u5230\u8fdc\u7a0b\u670d\u52a1\u5668\u3002\u5b83\u4f7f\u7528\u4e86 inotify \u673a\u5236\u6765\u76d1\u63a7\u6587\u4ef6\u7cfb\u7edf\u7684\u53d8\u5316\uff0c\u5e76\u53ef\u4ee5\u901a\u8fc7 rsync \u534f\u8bae\u6216 FTP \u6765\u4f20\u8f93\u6587\u4ef6\u3002<code>sersync<\/code> \u975e\u5e38\u9002\u5408\u9700\u8981\u9ad8\u5b9e\u65f6\u6027\u6587\u4ef6\u540c\u6b65\u7684\u573a\u666f\uff0c\u6bd4\u5982\u7f51\u7ad9\u7684\u955c\u50cf\u5907\u4efd\u6216\u8005\u591a\u670d\u52a1\u5668\u8d1f\u8f7d\u5747\u8861\u73af\u5883\u4e0b\u7684\u6587\u4ef6\u5171\u4eab\u3002<\/p>\n<h2>\u539f\u7406<\/h2>\n<p><code>sersync<\/code> \u7ed3\u5408\u4e86\u4e24\u4e2a\u6838\u5fc3\u6280\u672f\uff1a<code>inotify<\/code> \u548c <code>rsync<\/code>\u3002<\/p>\n<ul>\n<li><strong>Inotify<\/strong> \u662f Linux \u5185\u6838\u7684\u4e00\u4e2a\u7279\u6027\uff0c\u80fd\u591f\u76d1\u63a7\u6587\u4ef6\u7cfb\u7edf\u4e8b\u4ef6\uff0c\u5982\u6587\u4ef6\u7684\u521b\u5efa\u3001\u4fee\u6539\u3001\u5220\u9664\u7b49\u3002<\/li>\n<li><strong>Rsync<\/strong> \u662f\u4e00\u4e2a\u6587\u4ef6\u540c\u6b65\u548c\u6587\u4ef6\u4f20\u8f93\u7a0b\u5e8f\uff0c\u53ef\u4ee5\u4f18\u5316\u6587\u4ef6\u6570\u636e\u7684\u4f20\u8f93\uff0c\u53ea\u540c\u6b65\u53d8\u5316\u7684\u90e8\u5206\uff0c\u51cf\u5c11\u6570\u636e\u4f20\u8f93\u91cf\u3002<\/li>\n<\/ul>\n<p><code>sersync<\/code> \u5229\u7528 <code>inotify<\/code> \u5b9e\u65f6\u76d1\u63a7\u6307\u5b9a\u76ee\u5f55\u4e0b\u7684\u6587\u4ef6\u53d8\u5316\u4e8b\u4ef6\uff0c\u5e76\u89e6\u53d1 <code>rsync<\/code> \u547d\u4ee4\u6765\u540c\u6b65\u8fd9\u4e9b\u53d8\u5316\u5230\u8fdc\u7a0b\u7cfb\u7edf\u3002\u8fd9\u79cd\u7ed3\u5408\u65b9\u5f0f\u4f7f\u5f97\u6587\u4ef6\u540c\u6b65\u51e0\u4e4e\u5b9e\u65f6\u8fdb\u884c\uff0c\u5927\u5927\u51cf\u5c11\u4e86\u6570\u636e\u7684\u5ef6\u8fdf\u3002<\/p>\n<h2>\u57fa\u4e8ersync daemon \u5b9e\u73b0 sersync<\/h2>\n<blockquote>\n<p>sersync\u9879\u76ee\u8def\u5f84\uff1a<a href=\"https:\/\/code.google.com\/archive\/p\/sersync\/\">https:\/\/code.google.com\/archive\/p\/sersync\/<\/a><\/p>\n<\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/typora-images-1307361841.cos.ap-beijing.myqcloud.com\/img\/image-20240417134427171.png\" alt=\"image-20240417134427171\" \/><\/p>\n<p>\u5907\u4efd\u670d\u52a1\u5668\u914d\u7f6e<\/p>\n<pre><code class=\"language-bash\">[root@backup-server ~]# yum -y install rsync-daemon\n[root@backup-server ~]# systemctl enable --now rsyncd\n[root@backup-server ~]# vim \/etc\/rsyncd.conf\npid file = \/var\/run\/rsyncd.pid\nlog file = \/var\/log\/rsyncd.log\nlock file = \/var\/run\/rsyncd.lock\nuid = root\ngid = root\nport = 873\nuse chroot = yes\nmax connections = 0\nignore errors\nexclude = lost+found\/\nreverse lookup = no\n[backup]\n    path = \/data\/backup\n    comment = Backup folder\n    read only = no\n    list = yes\n    auth users = rsyncuser\n    secrets file = \/etc\/rsyncd.secrets\n[root@backup-server ~]#\n[root@data-server ~]# echo &quot;123456&quot; &gt; \/etc\/rsyncd.secrets\n# \u4fee\u6539\u6743\u9650\n[root@data-server ~]# chmod 600 \/etc\/rsyncd.secrets<\/code><\/pre>\n<p>\u6570\u636e\u670d\u52a1\u5668\u914d\u7f6e<\/p>\n<pre><code class=\"language-bash\"># \u5728\u6570\u636e\u670d\u52a1\u5668\u4e0a\u4e0b\u8f7dsersync,\u5e76\u62f7\u8d1d\u5230\/usr\/local\/\u4e0b\uff0c\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\n[09:29:27 root@data-server ~]#tar xvf sersync2.5.4_64bit_binary_stable_final.tar.gz\nGNU-Linux-x86\/\nGNU-Linux-x86\/sersync2\nGNU-Linux-x86\/confxml.xml\n[09:29:27 root@data-server ~]#mv GNU-Linux-x86\/ \/usr\/local\/sersync\n[09:33:59 root@data-server ~]#ll \/usr\/local\/sersync\ntotal 1772\n-rwxr-xr-x 1 root root    2214 Oct 26  2011 confxml.xml\n-rwxr-xr-x 1 root root 1810128 Oct 26  2011 sersync2\n[09:35:21 root@data-server ~]#ln -s \/usr\/local\/sersync\/sersync2 \/usr\/bin\/\n# sersync\u5e95\u5c42\u4e5f\u662f\u4f7f\u7528inotify\u548crsync\uff0c\u6240\u4ee5\u8981\u786e\u4fdd\u5b89\u88c5rsync\u5ba2\u6237\u7aef\u5de5\u5177\n[09:35:21 root@data-server ~]#rpm -q rsync &amp;&gt; \/dev\/null || dnf -y install rsync\n#\u4fee\u6539sersync\u914d\u7f6e\u6587\u4ef6\n[15:14:23 root@data-server www]#vi \/usr\/local\/sersync\/confxml.xml\n&lt;?xml version=&quot;1.0&quot; encoding=&quot;ISO-8859-1&quot;?&gt;\n&lt;head version=&quot;2.5&quot;&gt;\n    &lt;host hostip=&quot;localhost&quot; port=&quot;8008&quot;&gt;&lt;\/host&gt;\n    &lt;debug start=&quot;true&quot;\/&gt; &lt;!-- \u662f\u5426\u5f00\u542f\u8c03\u8bd5\u6a21\u5f0f --&gt;\n    &lt;fileSystem xfs=&quot;false&quot;\/&gt;\n    &lt;filter start=&quot;false&quot;&gt; &lt;!-- \u4e0d\u5f00\u542f\u6587\u4ef6\u8fc7\u6ee4\u529f\u80fd\uff0c\u5f53\u4e3atrue\u65f6,\u4ee5\u4e0b\u7c7b\u578b\u7684\u6587\u4ef6\u5c06\u4e0d\u540c\u6b69 --&gt;\n &lt;exclude expression=&quot;(.*)\\.svn&quot;&gt;&lt;\/exclude&gt;\n &lt;exclude expression=&quot;(.*)\\.gz&quot;&gt;&lt;\/exclude&gt;\n &lt;exclude expression=&quot;^info\/*&quot;&gt;&lt;\/exclude&gt;\n &lt;exclude expression=&quot;^static\/*&quot;&gt;&lt;\/exclude&gt;\n    &lt;\/filter&gt;\n    &lt;inotify&gt;\n &lt;delete start=&quot;true&quot;\/&gt; &lt;!-- \u76d1\u63a7\u5220\u9664\u4e8b\u4ef6 --&gt;\n &lt;createFolder start=&quot;true&quot;\/&gt;  &lt;!-- \u76d1\u63a7\u521b\u5efa\u6587\u4ef6\u5939\u4e8b\u4ef6 --&gt;\n &lt;createFile start=&quot;true&quot;\/&gt; &lt;!-- \u76d1\u63a7\u521b\u5efa\u6587\u4ef6\u4e8b\u4ef6 --&gt;\n &lt;closeWrite start=&quot;true&quot;\/&gt;\n &lt;moveFrom start=&quot;true&quot;\/&gt; &lt;!-- \u76d1\u63a7\u6587\u4ef6\u79fb\u52a8\u4e8b\u4ef6 --&gt;\n &lt;moveTo start=&quot;true&quot;\/&gt; \n &lt;attrib start=&quot;true&quot;\/&gt; &lt;!-- \u76d1\u63a7\u6587\u4ef6\u6743\u9650\u4fee\u6539\u4e8b\u4ef6 --&gt;\n &lt;modify start=&quot;true&quot;\/&gt; &lt;!-- \u76d1\u63a7\u6587\u4ef6\u4fee\u6539\u4e8b\u4ef6 --&gt;\n    &lt;\/inotify&gt;\n\n    &lt;sersync&gt;\n &lt;localpath watch=&quot;\/data\/www&quot;&gt; &lt;!-- \u76d1\u63a7\u7684\u672c\u5730\u76ee\u5f55 --&gt;\n     &lt;remote ip=&quot;10.0.0.107&quot; name=&quot;backup&quot;\/&gt; &lt;!-- \u540c\u6b65\u76ee\u6807\u7684 IP \u548c\u540d\u79f0 --&gt;\n     &lt;!--&lt;remote ip=&quot;192.168.8.39&quot; name=&quot;tongbu&quot;\/&gt;--&gt;\n     &lt;!--&lt;remote ip=&quot;192.168.8.40&quot; name=&quot;tongbu&quot;\/&gt;--&gt;\n &lt;\/localpath&gt;\n &lt;rsync&gt;\n     &lt;commonParams params=&quot;-az&quot;\/&gt; &lt;!-- rsync \u901a\u7528\u53c2\u6570-artuz --&gt;\n     &lt;auth start=&quot;true&quot; users=&quot;rsyncuser&quot; passwordfile=&quot;\/etc\/rsyncd.secrets&quot;\/&gt; &lt;!-- rsync \u9a8c\u8bc1\u7528\u6237\uff0c\u4ee5\u53ca\u9a8c\u8bc1\u7528\u6237\u5bc6\u7801\u7684\u5b58\u653e\u8def\u5f84 --&gt;\n     &lt;userDefinedPort start=&quot;false&quot; port=&quot;874&quot;\/&gt;&lt;!-- port=874 --&gt;\n     &lt;timeout start=&quot;false&quot; time=&quot;100&quot;\/&gt;&lt;!-- timeout=100 --&gt;\n     &lt;ssh start=&quot;false&quot;\/&gt;\n &lt;\/rsync&gt;\n &lt;failLog path=&quot;\/tmp\/rsync_fail_log.sh&quot; timeToExecute=&quot;60&quot;\/&gt;&lt;!--default every 60mins execute once--&gt;\n &lt;crontab start=&quot;false&quot; schedule=&quot;600&quot;&gt;&lt;!--600mins--&gt;\n     &lt;crontabfilter start=&quot;false&quot;&gt;\n   &lt;exclude expression=&quot;*.php&quot;&gt;&lt;\/exclude&gt;\n   &lt;exclude expression=&quot;info\/*&quot;&gt;&lt;\/exclude&gt;\n     &lt;\/crontabfilter&gt;\n &lt;\/crontab&gt;\n &lt;plugin start=&quot;false&quot; name=&quot;command&quot;\/&gt;\n    &lt;\/sersync&gt;\n\n    &lt;plugin name=&quot;command&quot;&gt;\n &lt;param prefix=&quot;\/bin\/sh&quot; suffix=&quot;&quot; ignoreError=&quot;true&quot;\/&gt; &lt;!--prefix \/opt\/tongbu\/mmm.sh suffix--&gt;\n &lt;filter start=&quot;false&quot;&gt;\n     &lt;include expression=&quot;(.*)\\.php&quot;\/&gt;\n     &lt;include expression=&quot;(.*)\\.sh&quot;\/&gt;\n &lt;\/filter&gt;\n    &lt;\/plugin&gt;\n\n    &lt;plugin name=&quot;socket&quot;&gt;\n &lt;localpath watch=&quot;\/opt\/tongbu&quot;&gt;\n     &lt;deshost ip=&quot;192.168.138.20&quot; port=&quot;8009&quot;\/&gt;\n &lt;\/localpath&gt;\n    &lt;\/plugin&gt;\n    &lt;plugin name=&quot;refreshCDN&quot;&gt;\n &lt;localpath watch=&quot;\/data0\/htdocs\/cms.xoyo.com\/site\/&quot;&gt;\n     &lt;cdninfo domainname=&quot;ccms.chinacache.com&quot; port=&quot;80&quot; username=&quot;xxxx&quot; passwd=&quot;xxxx&quot;\/&gt;\n     &lt;sendurl base=&quot;http:\/\/pic.xoyo.com\/cms&quot;\/&gt;\n     &lt;regexurl regex=&quot;false&quot; match=&quot;cms.xoyo.com\/site([\/a-zA-Z0-9]*).xoyo.com\/images&quot;\/&gt;\n &lt;\/localpath&gt;\n    &lt;\/plugin&gt;\n&lt;\/head&gt;\n[15:14:23 root@data-server www]#\n# \u521b\u5efa\u8fde\u63a5rsynd\u670d\u52a1\u5668\u7684\u7528\u6237\u5bc6\u7801\u6587\u4ef6,\u5e76\u5fc5\u987b\u4fee\u6539\u6743\u9650\n[15:14:23 root@data-server www]# echo 123456 &gt; \/etc\/rsyncd.secrets\n[15:14:23 root@data-server www]# chmod 600 \/etc\/rsyncd.secrets\n\n# \u67e5\u770b\u5e2e\u52a9\n[15:14:23 root@data-server www]# sersync2 -h\nset the system param\nexecute\uff1aecho 50000000 &gt; \/proc\/sys\/fs\/inotify\/max_user_watches\nexecute\uff1aecho 327679 &gt; \/proc\/sys\/fs\/inotify\/max_queued_events\nparse the command param\n_______________________________________________________\n\u53c2\u6570-d:\u542f\u7528\u5b88\u62a4\u8fdb\u7a0b\u6a21\u5f0f\n\u53c2\u6570-r:\u5728\u76d1\u63a7\u524d\uff0c\u5c06\u76d1\u63a7\u76ee\u5f55\u4e0e\u8fdc\u7a0b\u4e3b\u673a\u7528rsync\u547d\u4ee4\u63a8\u9001\u4e00\u904d\nc\u53c2\u6570-n: \u6307\u5b9a\u5f00\u542f\u5b88\u62a4\u7ebf\u7a0b\u7684\u6570\u91cf\uff0c\u9ed8\u8ba4\u4e3a10\u4e2a\n\u53c2\u6570-o:\u6307\u5b9a\u914d\u7f6e\u6587\u4ef6\uff0c\u9ed8\u8ba4\u4f7f\u7528confxml.xml\u6587\u4ef6\n\u53c2\u6570-m:\u5355\u72ec\u542f\u7528\u5176\u4ed6\u6a21\u5757\uff0c\u4f7f\u7528 -m refreshCDN \u5f00\u542f\u5237\u65b0CDN\u6a21\u5757\n\u53c2\u6570-m:\u5355\u72ec\u542f\u7528\u5176\u4ed6\u6a21\u5757\uff0c\u4f7f\u7528 -m socket \u5f00\u542fsocket\u6a21\u5757\n\u53c2\u6570-m:\u5355\u72ec\u542f\u7528\u5176\u4ed6\u6a21\u5757\uff0c\u4f7f\u7528 -m http \u5f00\u542fhttp\u6a21\u5757\n\u4e0d\u52a0-m\u53c2\u6570\uff0c\u5219\u9ed8\u8ba4\u6267\u884c\u540c\u6b65\u7a0b\u5e8f\n________________________________________________________________\n<\/code><\/pre>\n<p>\u8fde\u63a5\u6d4b\u8bd5<\/p>\n<pre><code class=\"language-bash\"># \u4ee5\u540e\u53f0\u65b9\u5f0f\u542f\u52a8\n[15:14:23 root@data-server www]# sersync2 -dro \/usr\/local\/sersync\/confxml.xml\n# \u4ee5\u524d\u53f0\u65b9\u5f0f\u6267\u884c\u540c\u6b65\uff0c\u5f00\u542fdebug\u6a21\u5f0f\uff0c\u65b9\u4fbf\u770b\u5230\u7ed3\u679c\n[10:50:25 root@data-server www]# sersync2 -ro \/usr\/local\/sersync\/confxml.xml\nset the system param\nexecute\uff1aecho 50000000 &gt; \/proc\/sys\/fs\/inotify\/max_user_watches\nexecute\uff1aecho 327679 &gt; \/proc\/sys\/fs\/inotify\/max_queued_events\nparse the command param\noption: -r  rsync all the local files to the remote servers before the sersync work\noption: -o  config xml name\uff1a  \/usr\/local\/sersync\/confxml.xml\ndaemon thread num: 10\nparse xml config file\nhost ip : localhost host port: 8008\nwill ignore the inotify createFile event\nOpen debug, you will see debug infomation\nuse rsync password-file :\nuser is rsyncuser\npasswordfile is  \/etc\/rsyncd.secrets\nconfig xml parse success\nplease set \/etc\/rsyncd.conf max connections=0 Manually\nsersync working thread 12  = 1(primary thread) + 1(fail retry thread) + 10(daemon sub threads)\nMax threads numbers is: 22 = 12(Thread pool nums) + 10(Sub threads)\nplease according your cpu \uff0cuse -n param to adjust the cpu rate\n------------------------------------------\nrsync the directory recursivly to the remote servers once\nworking please wait...\nexecute command: cd \/data\/www &amp;&amp; rsync -az -R --delete .\/ rsyncuser@10.0.0.107::backup --password-file=\/etc\/rsyncd.secrets\ncrontab command:cd \/data\/www &amp;&amp; rsync -az -R --delete .\/ rsyncuser@10.0.0.107::backup --password-file=\/etc\/rsyncd.secrets\nrun the sersync:\nwatch path is: \/data\/www\nadd watch: \/data\/www return wd is: 1\n\n# \u5728\u6d4b\u8bd5\u8fc7\u7a0b\u53d1\u73b0\u5f53rsync\u7684\u53c2\u6570\u662f -artuz\u7684\u65f6\u5019\uff0c\u6211\u521b\u5efa\uff0c\u5220\u9664\u6587\u4ef6\u662f\u6ca1\u6709\u95ee\u9898\u7684\uff0c\u4f46\u662f\u6211\u4fee\u6539\u6587\u4ef6\u6743\u9650\u7684\u65f6\u5019(chmod\/chown)\u5c31\u540c\u6b65\u4e0d\u8fc7\u53bb\uff0c\u8fd9\u662f\u56e0\u4e3au\u9009\u9879\u662f\u6e90\u6587\u4ef6\u6bd4\u76ee\u6807\u6587\u4ef6\u65b0\u624d\u4f1a\u62f7\u8d1d\uff0c\u4f46\u662f\u5f53\u6211\u4eec\u4f7f\u7528chmod\u4fee\u6539\u4ee5\u540e\uff0c\u6587\u4ef6\u7684mtime\u662f\u4e0d\u4f1a\u53d8\u7684\uff0c\u800c\u662fctime\u5728\u53d8\uff0c\u4f46\u662frsync\u53ea\u76d1\u63a7mtime\uff0c\u6240\u4ee5\u4e0d\u5f97\u5df2\u628au\u53bb\u6389\u4e86\uff0c\u5c31\u53ef\u4ee5\u4e86\u3002\n[15:50:13 root@data-server www]#stat b.txt\n  File: b.txt\n  Size: 0           Blocks: 0          IO Block: 4096   regular empty file\nDevice: 803h\/2051d  Inode: 33554561    Links: 1\nAccess: (0000\/----------)  Uid: (  100\/    xing)   Gid: ( 1000\/    xing)\nAccess: 2024-04-17 10:50:40.288807321 +0800\nModify: 2024-04-17 10:50:40.288807321 +0800\nChange: 2024-04-17 10:51:15.206601870 +0800\n Birth: 2024-04-17 10:50:40.288807321 +0800\n[15:50:17 root@data-server www]#\n\n#sersync\u652f\u6301\u591a\u5b9e\u4f8b\uff0c\u4e5f\u5373\u76d1\u63a7\u591a\u4e2a\u76ee\u5f55\u65f6\uff0c\u53ea\u9700\u5206\u522b\u914d\u7f6e\u4e0d\u540c\u914d\u7f6e\u6587\u4ef6\uff0c\u7136\u540e\u4f7f\u7528sersync2\u6307\u5b9a\u5bf9\u5e94\u914d\u7f6e\u6587\u4ef6\u8fd0\u884c\n[root@data-centos8 ~]#sersync2 -rd -o \/etc\/sersync.d\/nginx.xml\n\n# \u5907\u4efd\u670d\u52a1\u5668\u4e0a\u76d1\u63a7\u6587\u4ef6\u53d8\u5316\n[root@backup-server backup]# watch -n0.5 ls -l \/data\/backup\/<\/code><\/pre>\n<h2>\u57fa\u4e8e\u8fdc\u7a0bshell \u5b9e\u73b0 sersync<\/h2>\n<pre><code class=\"language-bash\"># \u4e0d\u9700\u8981rsync-daemon\uff0c\u53ea\u9700\u8981\u914d\u7f6e\u57fa\u4e8ekey\u9a8c\u8bc1\u7684ssh\u5373\u53ef\n[15:19:05 root@data-server www]# ssh-keygen\n[15:19:05 root@data-server www]# ssh-copy-id 10.0.0.107\n\n# \u4e0b\u8f7dsersync\uff0c\u5e76\u62f7\u8d1d\u76f8\u5e94\u76ee\u5f55\uff0c\u914d\u7f6e\u73af\u5883\u53d8\u91cf\uff0c\u53c2\u8003\u4e0a\u9762\n\n# \u4fee\u6539sersync\u914d\u7f6e\u6587\u4ef6\n[15:19:05 root@data-server www]#cat \/usr\/local\/sersync\/confxml.xml\n&lt;?xml version=&quot;1.0&quot; encoding=&quot;ISO-8859-1&quot;?&gt;\n&lt;head version=&quot;2.5&quot;&gt;\n    &lt;host hostip=&quot;localhost&quot; port=&quot;8008&quot;&gt;&lt;\/host&gt;\n    &lt;debug start=&quot;true&quot;\/&gt;\n    &lt;fileSystem xfs=&quot;false&quot;\/&gt;\n    &lt;filter start=&quot;false&quot;&gt;\n &lt;exclude expression=&quot;(.*)\\.svn&quot;&gt;&lt;\/exclude&gt;\n &lt;exclude expression=&quot;(.*)\\.gz&quot;&gt;&lt;\/exclude&gt;\n &lt;exclude expression=&quot;^info\/*&quot;&gt;&lt;\/exclude&gt;\n &lt;exclude expression=&quot;^static\/*&quot;&gt;&lt;\/exclude&gt;\n    &lt;\/filter&gt;\n    &lt;inotify&gt;\n &lt;delete start=&quot;true&quot;\/&gt;\n &lt;createFolder start=&quot;true&quot;\/&gt;\n &lt;createFile start=&quot;true&quot;\/&gt;\n &lt;closeWrite start=&quot;true&quot;\/&gt;\n &lt;moveFrom start=&quot;true&quot;\/&gt;\n &lt;moveTo start=&quot;true&quot;\/&gt;\n &lt;attrib start=&quot;true&quot;\/&gt;\n &lt;modify start=&quot;true&quot;\/&gt;\n    &lt;\/inotify&gt;\n\n    &lt;sersync&gt;\n &lt;localpath watch=&quot;\/data\/www&quot;&gt;\n     &lt;remote ip=&quot;10.0.0.107&quot; name=&quot;\/data\/backup&quot;\/&gt; &lt;!--\u7531\u4e8e\u662f\u57fa\u4e8essh\u4f20\u8f93\uff0c\u6240\u4ee5\u8fd9\u91cc\u4e0d\u5199\u6a21\u5757\u540d\u79f0\u4e86\uff0c\u8981\u5199\u771f\u5b9e\u7684\u76ee\u5f55--&gt;\n     &lt;!--&lt;remote ip=&quot;192.168.8.39&quot; name=&quot;tongbu&quot;\/&gt;--&gt;\n     &lt;!--&lt;remote ip=&quot;192.168.8.40&quot; name=&quot;tongbu&quot;\/&gt;--&gt;\n &lt;\/localpath&gt;\n &lt;rsync&gt;\n     &lt;commonParams params=&quot;-az&quot;\/&gt;\n     &lt;auth start=&quot;false&quot; users=&quot;rsyncuser&quot; passwordfile=&quot;\/etc\/rsyncd.secrets&quot;\/&gt; &lt;!--\u5fc5\u987b\u4fee\u6539\uff0c\u4e0d\u542f\u7528\u8ba4\u8bc1 start=&quot;false&quot; --&gt;\n     &lt;userDefinedPort start=&quot;false&quot; port=&quot;874&quot;\/&gt;&lt;!-- port=874 --&gt;\n     &lt;timeout start=&quot;false&quot; time=&quot;100&quot;\/&gt;&lt;!-- timeout=100 --&gt;\n     &lt;ssh start=&quot;false&quot;\/&gt; &lt;!--\u4fee\u6539\u4e3atrue\uff0c\u4f7f\u7528\u8fdc\u7a0bshell\u65b9\u5f0f\u7684rsync\u8fde\u63a5\u65b9\u5f0f\uff0c\u65e0\u9700\u5728\u76ee\u6807\u4e3b\u673a\u4e0a\u914d\u7f6e\u542f\u52a8rsync-daemon\u670d\u52a1--&gt;\n &lt;\/rsync&gt;\n &lt;failLog path=&quot;\/tmp\/rsync_fail_log.sh&quot; timeToExecute=&quot;60&quot;\/&gt;&lt;!--default every 60mins execute once--&gt;\n &lt;crontab start=&quot;false&quot; schedule=&quot;600&quot;&gt;&lt;!--600mins--&gt;\n     &lt;crontabfilter start=&quot;false&quot;&gt;\n   &lt;exclude expression=&quot;*.php&quot;&gt;&lt;\/exclude&gt;\n   &lt;exclude expression=&quot;info\/*&quot;&gt;&lt;\/exclude&gt;\n     &lt;\/crontabfilter&gt;\n &lt;\/crontab&gt;\n &lt;plugin start=&quot;false&quot; name=&quot;command&quot;\/&gt;\n    &lt;\/sersync&gt;\n\n    &lt;plugin name=&quot;command&quot;&gt;\n &lt;param prefix=&quot;\/bin\/sh&quot; suffix=&quot;&quot; ignoreError=&quot;true&quot;\/&gt; &lt;!--prefix \/opt\/tongbu\/mmm.sh suffix--&gt;\n &lt;filter start=&quot;false&quot;&gt;\n     &lt;include expression=&quot;(.*)\\.php&quot;\/&gt;\n     &lt;include expression=&quot;(.*)\\.sh&quot;\/&gt;\n &lt;\/filter&gt;\n    &lt;\/plugin&gt;\n\n    &lt;plugin name=&quot;socket&quot;&gt;\n &lt;localpath watch=&quot;\/opt\/tongbu&quot;&gt;\n     &lt;deshost ip=&quot;192.168.138.20&quot; port=&quot;8009&quot;\/&gt;\n &lt;\/localpath&gt;\n    &lt;\/plugin&gt;\n    &lt;plugin name=&quot;refreshCDN&quot;&gt;\n &lt;localpath watch=&quot;\/data0\/htdocs\/cms.xoyo.com\/site\/&quot;&gt;\n     &lt;cdninfo domainname=&quot;ccms.chinacache.com&quot; port=&quot;80&quot; username=&quot;xxxx&quot; passwd=&quot;xxxx&quot;\/&gt;\n     &lt;sendurl base=&quot;http:\/\/pic.xoyo.com\/cms&quot;\/&gt;\n     &lt;regexurl regex=&quot;false&quot; match=&quot;cms.xoyo.com\/site([\/a-zA-Z0-9]*).xoyo.com\/images&quot;\/&gt;\n &lt;\/localpath&gt;\n    &lt;\/plugin&gt;\n&lt;\/head&gt;\n\n# \u6d4b\u8bd5\n[15:19:05 root@data-server www]#sersync2 -dro \/usr\/local\/sersync\/confxml.xml\n\n# \u5907\u4efd\u670d\u52a1\u5668\u4e0a\u76d1\u63a7\u6587\u4ef6\u53d8\u5316\n[root@backup-server backup]# watch -n0.5 ls -l \/data\/backup\/<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>sersync \u662f\u4e00\u79cd\u57fa\u4e8e Linux \u7684\u5f00\u6e90\u5de5\u5177\uff0c\u4e3b\u8981\u7528\u4e8e\u5b9e\u65f6\u540c\u6b65\u6587\u4ef6\u548c\u6587\u4ef6\u5939\u5230\u8fdc\u7a0b\u670d\u52a1\u5668\u3002\u5b83\u4f7f\u7528 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[74],"tags":[77],"views":441,"_links":{"self":[{"href":"http:\/\/8.141.4.74\/index.php?rest_route=\/wp\/v2\/posts\/475"}],"collection":[{"href":"http:\/\/8.141.4.74\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/8.141.4.74\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/8.141.4.74\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/8.141.4.74\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=475"}],"version-history":[{"count":1,"href":"http:\/\/8.141.4.74\/index.php?rest_route=\/wp\/v2\/posts\/475\/revisions"}],"predecessor-version":[{"id":476,"href":"http:\/\/8.141.4.74\/index.php?rest_route=\/wp\/v2\/posts\/475\/revisions\/476"}],"wp:attachment":[{"href":"http:\/\/8.141.4.74\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=475"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/8.141.4.74\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=475"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/8.141.4.74\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=475"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}