Online casino Philippines using gcash {"id":301,"date":"2010-04-26T00:42:00","date_gmt":"2010-04-25T16:42:00","guid":{"rendered":"http:\/\/wp.imkylin.cn\/?p=301"},"modified":"2010-04-26T00:42:00","modified_gmt":"2010-04-25T16:42:00","slug":"sersync%e4%b8%bb%e8%a6%81%e7%94%a8%e4%ba%8e%e6%9c%8d%e5%8a%a1%e5%99%a8%e5%90%8c%e6%ad%a5%ef%bc%8cweb%e9%95%9c%e5%83%8f%e7%ad%89%e5%8a%9f%e8%83%bd","status":"publish","type":"post","link":"http:\/\/wp.imkylin.cn\/archives\/301","title":{"rendered":"sersync\u4e3b\u8981\u7528\u4e8e\u670d\u52a1\u5668\u540c\u6b65\uff0cweb\u955c\u50cf\u7b49\u529f\u80fd"},"content":{"rendered":"
\n

Introduce<\/a>: http:\/\/code.google.com\/p\/sersync\/<\/a> <\/h1>\n

<\/strong><\/a><\/p>\n

sersync\u4e3b\u8981\u7528\u4e8e\u670d\u52a1\u5668\u540c\u6b65\uff0cweb\u955c\u50cf\u7b49\u529f\u80fd\u3002\u57fa\u4e8eboost1.41.0,inotify api,rsync command.\u5f00\u53d1\u3002\u76ee\u524d\u4f7f\u7528\u7684\u6bd4\u8f83\u591a\u7684\u540c\u6b65\u89e3\u51b3\u65b9\u6848\u662finotify-tools+rsync \uff0c\u53e6\u5916\u4e00\u4e2a\u662fgoogle\u5f00\u6e90\u9879\u76eeOpenduckbill\uff08\u4f9d\u8d56\u4e8einotify- tools\uff09\uff0c\u8fd9\u4e24\u4e2a\u90fd\u662f\u57fa\u4e8e\u811a\u672c\u8bed\u8a00\u7f16\u5199\u7684\u3002\u76f8\u6bd4\u8f83\u4e0a\u9762\u4e24\u4e2a\u9879\u76ee\uff0c\u672c\u9879\u76ee\u4f18\u70b9\u662f\uff1a<\/strong> <\/a><\/p><\/blockquote>\n

    \n
  1. sersync\u662f\u4f7f\u7528c++\u7f16\u5199\uff0c\u800c\u4e14\u5bf9linux\u7cfb\u7edf\u6587\u4ef6\u7cfb\u7edf\u4ea7\u751f\u7684\u4e34\u65f6\u6587\u4ef6\u548c\u91cd\u590d\u7684\u6587\u4ef6\u64cd\u4f5c\u8fdb\u884c\u8fc7\u6ee4\uff08\u8be6\u7ec6\u89c1\u9644\u5f55\uff0c\u8fd9\u4e2a\u8fc7\u6ee4\u811a\u672c\u7a0b\u5e8f\u6ca1\u6709\u5b9e\u73b0\uff09\uff0c\u6240\u4ee5\u5728\u7ed3\u5408rsync\u540c\u6b65\u7684\u65f6\u5019\uff0c\u8282\u7701\u4e86\u8fd0\u884c\u65f6\u8017\u548c\u7f51\u7edc\u8d44\u6e90\u3002\u56e0\u6b64\u66f4\u5feb\u3002 <\/a><\/li>\n
  2. \u76f8\u6bd4\u8f83\u4e0a\u9762\u4e24\u4e2a\u9879\u76ee\uff0csersync\u914d\u7f6e\u8d77\u6765\u5f88\u7b80\u5355\uff0c\u5176\u4e2dbin\u76ee\u5f55\u4e0b\u5df2\u7ecf\u6709\u57fa\u672c\u4e0a\u9759\u6001\u7f16\u8bd1\u76842\u8fdb\u5236\u6587\u4ef6\uff0c\u914d\u5408bin\u76ee\u5f55\u4e0b\u7684xml\u914d\u7f6e\u6587\u4ef6\u76f4\u63a5\u4f7f\u7528\u5373\u53ef\u3002 <\/a><\/li>\n
  3. \u53e6\u5916\u672c\u9879\u76ee\u76f8\u6bd4\u8f83\u5176\u4ed6\u811a\u672c\u5f00\u6e90\u9879\u76ee\uff0c\u4f7f\u7528\u591a\u7ebf\u7a0b\u8fdb\u884c\u540c\u6b65\uff0c\u5c24\u5176\u5728\u540c\u6b65\u8f83\u5927\u6587\u4ef6\u65f6\uff0c\u80fd\u591f\u4fdd\u8bc1\u591a\u4e2a\u670d\u52a1\u5668\u5b9e\u65f6\u4fdd\u6301\u540c\u6b65\u72b6\u6001\u3002 <\/a><\/li>\n
  4. \u672c\u9879\u76ee\u6709\u51fa\u9519\u5904\u7406\u673a\u5236\uff0c\u901a\u8fc7\u5931\u8d25\u961f\u5217\u5bf9\u51fa\u9519\u7684\u6587\u4ef6\u91cd\u65b0\u540c\u6b65\uff0c\u5982\u679c\u4ecd\u65e7\u5931\u8d25\uff0c\u5219\u6bcf10\u4e2a\u5c0f\u65f6\u5bf9\u540c\u6b65\u5931\u8d25\u7684\u6587\u4ef6\u91cd\u65b0\u540c\u6b65\u3002 <\/a><\/li>\n
  5. \u672c\u9879\u76ee\u81ea\u5e26crontab\u529f\u80fd\uff0c\u53ea\u9700\u5728 xml\u914d\u7f6e\u6587\u4ef6\u4e2d\u5f00\u542f\uff0c\u5373\u53ef\u6309\u60a8\u7684\u8981\u6c42\uff0c\u9694\u4e00\u6bb5\u65f6\u95f4\u6574\u4f53\u540c\u6b65\u4e00\u6b21\u3002\u65e0\u9700\u518d\u989d\u5916\u914d\u7f6ecrontab\u529f\u80fd\u3002 <\/a><\/li>\n
  6. \u672c\u9879\u76eesocket\u4e0ehttp\u63d2\u4ef6\u6269\u5c55\uff0c\u6ee1\u8db3\u60a8\u4e8c\u6b21\u5f00\u53d1\u7684\u9700\u8981\u3002 <\/a><\/li>\n<\/ol>\n
    \n

    <\/strong><\/a> <\/p>\n

    sersync is mainly used in server synchronization and web mirroring, developed Based on boost1.41.0, inotify api, rsync command. Currently, common synchronous solutions use inotify-tools + rsync,or use google open source project Openduckbill (depends on inotify-tools), which are both written in script languages. Compared to the above two projects, this project has following benefits : <\/strong><\/a><\/p><\/blockquote>\n

      \n
    1. Sersync is developed by c ++, it can filter lots of temporary files and duplicated inotify events generated by linux file system(for details see the appendix, the filter function is difficult for script program to implement),so it can save more time and network resources. <\/a><\/li>\n
    2. Compare the above two projects, sersync is easy to use.You can use the binary executable file and the xml configuration file directly,both of them are in the bin directory. <\/a><\/li>\n
    3. Compared to other script programs,sersync uses multiple threads to synchronize , especially used in synchronizing large files, it can ensure multiple servers to keep synchronization in real-time. <\/a><\/li>\n
    4. The project has an error handling mechanism,add all the failed event to failure queue and try again, if still fails, sersync will retry every 10 hours until it is successfully synchronized . <\/a><\/li>\n
    5. The project has crontab function.using the xml configuration file, you can according to your requirements, sync the whole monitor directory from time to time. <\/a><\/li>\n
    6. The project has socket and http plugin extensions which can meet your secondary development needs. <\/a><\/li>\n<\/ol>\n

      Design Frame<\/a><\/h1>\n

      <\/a><\/p><\/blockquote>\n

      <\/a><\/p>\n

      Compile<\/a><\/h1>\n

      \u5982\u679c\u4f7f\u7528linux \u7cfb\u7edf\uff0c\u4e00\u822c\u60c5\u51b5\u4e0b\uff0c\u4e0d\u9700\u8981\u7f16\u8bd1\uff0c\u76f4\u63a5\u4f7f\u7528bin\u76ee\u5f55\u4e0b\u7684\u53ef\u6267\u884c\u6587\u4ef6\u548cxml\u914d\u7f6e\u6587\u4ef6\u5373\u53ef\u3002 src\u76ee\u5f55\u4e0b\u653e\u7684\u662f\u6e90\u7801 <\/a><\/p>\n

      lib\u76ee\u5f55\u4e0b\u662f\u9700\u8981\u7684\u9759\u6001\u5e93 <\/a><\/p>\n

      bin\u76ee\u5f55\u662f\u6700\u540e\u751f\u6210\u7684\u4e8c\u8fdb\u5236\u6587\u4ef6 <\/a><\/p>\n

      \u5728sersync \u76ee\u5f55\u4e0b\u6267\u884cmake\u547d\u4ee4\uff0c\u5c31\u4f1a\u5c06\u751f\u6210\u76842\u8fdb\u5236\u6587\u4ef6\u653e\u5165bin\u76ee\u5f55\u4e0b\u3002 <\/a><\/p>\n


      \n

      if you are using linux, under normal circumstances, do not need to compile, directly use the executable file and the xml configuration file under the bin directory <\/a> <\/p>\n

      src directory: the source files. <\/a><\/p>\n

      include directory: the boost head files(1.41.0). <\/a><\/p>\n

      lib directory: static libraries. <\/a><\/p>\n

      bin directory: binary executable file and xml configuration file. <\/a><\/p>\n

      You can execute make command in sersync directory which will generate binary file into the bin directory. <\/a><\/p>\n

      Install<\/a><\/h1>\n

      Config Rsync before install<\/a><\/h2>\n

      \u6ce8\u610f\u5728\u4f7f\u7528\u524d\uff0c\u9700\u8981\u5bf9\u6bcf\u53f0\u670d\u52a1\u5668\u90fd\u914d\u7f6e\u5e76\u5f00\u542frsync\u5b88\u62a4\u8fdb\u7a0b\u3002\u901a\u5e38\u914d\u7f6e\u65b9\u6cd5\u5982\u4e0b\uff1a <\/a><\/p>\n

      Before use, you need to config rsync and open the rsync daemon on each server. Normally configured as follows: <\/a><\/p>\n

      vi  <\/span>\/<\/span>etc<\/span>\/<\/span>rsyncd<\/span>.<\/span>conf<\/span><\/a><\/pre>\n
      uid<\/span>=<\/span>root
      gid<\/span>=<\/span>root
      max connections<\/span>=<\/span>36000<\/span>
      <\/span>use<\/span> chroot<\/span>=<\/span>no<\/span>
      log file<\/span>=<\/span>\/var\/<\/span>log<\/span>\/<\/span>rsyncd<\/span>.<\/span>log
      pid file<\/span>=<\/span>\/var\/<\/span>run<\/span>\/<\/span>rsyncd<\/span>.<\/span>pid
      <\/span>lock<\/span> file<\/span>=<\/span>\/var\/<\/span>run<\/span>\/<\/span>rsyncd<\/span>.<\/span>lock<\/span>


      <\/span>\u3010<\/span>tongbu<\/span>\u3011<\/span>
      path<\/span>=<\/span>\/opt\/<\/span>tongbu
      comment <\/span>=<\/span> xoyo video files
      ignore errors
      read only <\/span>=<\/span> <\/span>no<\/span>
      hosts allow <\/span>=<\/span> <\/span>192.168<\/span>.<\/span>8.40<\/span>\/<\/span>26<\/span> <\/span>192.168<\/span>.<\/span>138.94<\/span>\/<\/span>24<\/span>
      hosts deny <\/span>=<\/span> <\/span>*<\/span><\/a><\/pre>\n

      \u914d\u7f6e\u53c2\u6570\u8be6\u60c5\uff0c\u8bf7google. <\/a><\/p>\n

      Configuration parameters, please google. <\/a><\/p>\n

      \u7136\u540e\u5728\u9700\u8981\u540c\u6b65\u7684\u5404\u670d\u52a1\u5668\u4e0a\u5f00\u542f rsync\u5b88\u62a4\u8fdb\u7a0b\uff1a <\/a><\/p>\n

      Then open rsync daemon on each server: <\/a><\/p>\n

      rsync <\/span>--<\/span>daemon<\/span><\/a><\/pre>\n

      Install sersync<\/a><\/h2>\n

      \u7531\u4e8e\u5927\u90e8\u5206\u5e93\u90fd\u662f\u9759\u6001\u7f16\u8bd1\u7684\uff0c\u6240\u4ee5\u5728\u88ab\u76d1\u63a7\u670d\u52a1\u5668\u4e0a\uff0c\u4fee\u6539\u597d\u914d\u7f6e\u6587\u4ef6\u540e\uff0c\u76f4\u63a5\u6267\u884c.\/sersync2.1 \u5373\u53ef\u3002 <\/a><\/p>\n

      Since most libraries are statically compiled, after modifying the configuration file, you can directly execute .\/sersync2.1 on the server being monitored. <\/a><\/p>\n

      tar zxvf sersync2<\/span>.<\/span>1.tar<\/span>.<\/span>gz

      cd sersync<\/span><\/a><\/pre>\n

      \u5728\u4f7f\u7528\u524d,\u586b\u5199\u914d\u7f6e\u6587\u4ef6\uff1a <\/a><\/p>\n

      before using , write the xml configuration file <\/a><\/p>\n

      vi confxml<\/span>.<\/span>xml<\/span><\/a><\/pre>\n

      \u6839\u636e\u4f7f\u7528\u63d2\u4ef6\u548c\u529f\u80fd\u7684\u4e0d\u540c\uff0c\u9700\u8981\u4fee\u6539\u914d\u7f6e\u6587\u4ef6\u7684\u4e0d\u540c\u90e8\u5206: <\/a><\/p>\n

      According to the use of different plug-ins and features you need to modify the different parts of the configuration file as follows: <\/a><\/p>\n

      synchronization funciton config<\/a><\/h3>\n

      \u53ea\u9700\u4fee\u6539 sersync\u6807\u7b7e\u4e0b\u7684\u5185\u5bb9\u5982\u4e0b\u5373\u53ef\uff1a <\/a><\/p>\n

      Just modify the sersync tab as follows: <\/a><\/p>\n

       <\/span><sersync><\/span>

        <\/span><localpath<\/span> <\/span>watch<\/span>=<\/span>\"\/opt\/tongbu\"<\/span>><\/span>

         <\/span><remote<\/span> <\/span>ip<\/span>=<\/span>\"192.168.8.42\"<\/span> <\/span>name<\/span>=<\/span>\"tongbu\"<\/span>\/><\/span>

         <\/span><remote<\/span> <\/span>ip<\/span>=<\/span>\"192.168.8.39\"<\/span> <\/span>name<\/span>=<\/span>\"tongbu\"<\/span>\/><\/span>

        <\/span><\/localpath><\/span>

        <\/span><crontab<\/span> <\/span>start<\/span>=<\/span>\"true\"<\/span> <\/span>schedule<\/span>=<\/span>\"30\"<\/span>\/><\/span>

        <\/span><plugin<\/span> <\/span>name<\/span>=<\/span>\"refreshCDN\"<\/span> <\/span>start<\/span>=<\/span>\"true\"<\/span>\/><\/span>

       <\/span><\/sersync><\/span><\/a><\/pre>\n

      \u5176\u4e2d\uff0clocalpath\u6807\u7b7e\u7684watch\u586b\u5199\u9700\u540c\u6b65\u7684\u672c\u5730\u8def\u5f84\uff0cremote\u6807\u7b7e\u7528\u6765\u586b\u5199\u8981\u540c\u6b65\u7684\u8fdc\u7a0b\u4e3b\u673aip\u4e0e\u6a21\u5757\u540d\u79f0\u3002crontab\u529f\u80fd\u5982\u679c\u5c06 start\u6807\u7b7e\u7f6e\u4e3atrue\uff0c\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6eschedule\u5c5e\u6027\u6765\u5236\u5b9a\u591a\u957f\u65f6\u95f4\u5bf9\u76d1\u63a7\u76ee\u5f55\u5f7b\u5e95\u540c\u6b65\u4e00\u6b21\u3002 <\/a><\/p>\n

      the watch attribute of localpath tag identify the local path which required synchronization, remote tag need to fill in the remote host ip and rsync module name. if set the crontab tag’s start label to true, the crontab will work. you can set the schedule properties to formulate how many minutes to synchronize the monitor directory wholly once. <\/a><\/p>\n

      plugin config<\/a><\/h2>\n

      \u5982\u4e0a\u9762\u7684xml\u6240\u793a\uff0c\u5176\u4e2dplugin\u6807\u7b7e\u662f\u5728\u540c\u6b65\u8fc7\u7a0b\u4e2d\uff0c\u4f7f\u7528\u63d2\u4ef6\u3002\u5f53\u524d\u4f7f\u7528\u7684\u662f\u5237\u65b0cdn\u63d2\u4ef6”refreshCDN”\uff0c <\/a><\/p>\n

        <\/span><plugin<\/span> <\/span>name<\/span>=<\/span>\"refreshCDN\"<\/span> <\/span>start<\/span>=<\/span>\"true\"<\/span>\/><\/span><\/a><\/pre>\n

      \u5373\u5728\u540c\u6b65\u8fc7\u7a0b\u4e2d\uff0c\u5c06\u6587\u4ef6\u53d1\u9001\u5230\u76ee\u7684\u670d\u52a1\u5668\u540e\uff0c\u6839\u636e\u89c4\u5219\u5237\u65b0cdn\u63a5\u53e3\u3002\u5982\u679c\u4e0d\u60f3\u4f7f\u7528\uff0c\u5219\u5c06 start\u5c5e\u6027\u8bbe\u4e3afalse\u5373\u53ef\u3002\u5982\u679c\u9700\u8981\u4f7f\u7528\u5176\u4ed6\u63d2\u4ef6\uff0c\u5219\u67e5\u770b\u5176\u4ed6 plugin\u6807\u7b7e\uff0c\u5c06\u63d2\u4ef6\u540d\u79f0\u6539\u4e3axml\u4e2d\u5176\u5b83\u63d2\u4ef6\u7684\u540d\u79f0\u5373\u53ef\u3002\u76ee\u524d\u652f\u6301\u7684\u6709refreshCDN socket http\u4e09\u4e2a\u63d2\u4ef6\u3002socket\u63d2\u4ef6\u662f\u5411\u6307\u5b9aip\u548c\u7aef\u53e3\u53d1\u9001inotify\u4e8b\u4ef6\uff0chttp\u63d2\u4ef6\u662f\u53d1\u9001\uff08post\uff09Inotify\u4e8b\u4ef6\u5230\u6307\u5b9a\u57df\u540d\u3002 <\/a><\/p>\n

      \u5237\u65b0CDN\u63d2\u4ef6\u914d\u7f6e\uff1a <\/a><\/p>\n

      \u8be5\u63d2\u4ef6\u6839\u636e chinaCDN\u7684\u534f\u8bae\uff0c\u8fdb\u884c\u8bbe\u8ba1\uff0c\u5f53\u6709\u6587\u4ef6\u4ea7\u751f\u7684\u65f6\u5019\uff0c\u5c31\u5411cdn\u63a5\u53e3\u53d1\u9001\u9700\u8981\u5237\u65b0\u7684\u8def\u5f84\u4f4d\u7f6e\u3002\u5237\u65b0CDN\u63d2\u4ef6\u9700\u8981\u914d\u7f6e\u7684xml\u6587\u4ef6\u5982\u4e0b\uff1a <\/a><\/p>\n

       <\/span><plugin<\/span> <\/span>name<\/span>=<\/span>\"refreshCDN\"<\/span>><\/span>

      - <\/span><localpath<\/span> <\/span>watch<\/span>=<\/span>\"\/data0\/htdocs\/cms.xoyo.com\/site\/\"<\/span>><\/span>

       <\/span><cdninfo<\/span> <\/span>domainname<\/span>=<\/span>\"ccms.chinacache.com\"<\/span> <\/span>port<\/span>=<\/span>\"80\"<\/span> <\/span>username<\/span>=<\/span>\"yourname\"<\/span> <\/span>passwd<\/span>=<\/span>\"yourpasswd\"<\/span> <\/span>\/><\/span>

       <\/span><sendurl<\/span> <\/span>base<\/span>=<\/span>\"http:\/\/pic.xoyo.com\/cms\"<\/span> <\/span>\/><\/span>

       <\/span><regexurl<\/span> <\/span>regex<\/span>=<\/span>\"false\"<\/span> <\/span>match<\/span>=<\/span>\"cms.xoyo.com\/site([\/a-zA-Z0-9]*).xoyo.com\/images\"<\/span> <\/span>\/><\/span>

       <\/span><\/localpath><\/span>

       <\/span><\/plugin><\/span><\/a><\/pre>\n

      \u5176\u4e2d localpath watch \u662f\u9700\u8981\u76d1\u63a7\u7684\u76ee\u5f55\uff0c\u5c06\u4f1a\u8986\u76d6sersync\u4e2d\u7684\u76d1\u63a7\u76ee\u5f55\u3002 <\/a><\/p>\n

      cdnifo\u6807\u7b7e\u6307\u5b9a\u4e86cdn\u63a5\u53e3\u7684\u57df\u540d\uff0c\u7aef\u53e3\u53f7\uff0c\u4ee5\u53ca\u7528\u6237\u540d\u4e0e\u5bc6\u7801\u3002 <\/a><\/p>\n

      sendurl\u6807\u7b7e\u662f\u9700\u8981\u5237\u65b0\u7684url\u7684\u524d\u7f00\u3002 <\/a><\/p>\n

      regexurl\u6807\u7b7e\u4e2d\u7684\uff0cregex\u5c5e\u6027\u4e3atrue\u65f6\u5019\uff0c\u4f7f\u7528match\u5c5e\u6027\u7684\u6b63\u5219\u8bed\u53e5\u5339\u914d inotify \u8fd4\u56de\u7684\u8def\u5f84\u4fe1\u606f\uff0c\u5e76\u5c06\u6b63\u5219\u5339\u914d\u5230\u7684\u90e8\u5206\u4f5c\u4e3aurl\u4e00\u90e8\u5206\uff0c <\/a><\/p>\n

      \u4e3e\u4f8b\uff0c\u5982\u679c\u4ea7\u751f\u6587\u4ef6\u4e8b\u4ef6\u4e3a: <\/a><\/p>\n

      \/data0\/htdoc\/cms.xoyo.com\/site\/jx3.xoyo.com\/image\/a\/123.txt <\/a><\/p>\n

      \u7ecf\u8fc7\u4e0a\u9762\u7684 match\u6b63\u5219\u5339\u914d\u540e\uff0c\u6700\u540e\u5237\u65b0\u7684\u8def\u5f84\u662f: <\/a><\/p>\n

      http:\/\/pic.xoyo.com\/cms\/jx3\/a\/123.txt<\/tt>; <\/a><\/p>\n

      \u5982\u679cregex\u5c5e\u6027\u4e3afalse\uff0c\u6700\u540e\u5237\u65b0\u7684\u8def\u5f84\u662f: <\/a><\/p>\n

      http:\/\/pic.xoyo.com\/cms\/jx3.xoyo.com\/images\/a\/123.txt<\/tt>; <\/a><\/p>\n

      socket \u4e0e http \u63a5\u53e3\u5f88\u7b80\u5355\uff0c\u586b\u5199xml\u6587\u4ef6\u5373\u53ef\u3002 <\/a><\/p>\n


      \n

      refresh CDN plugin config\uff1a <\/a> <\/p>\n

      this plugin is designed according to chinaCDN protocol , when there are inotify event arise, will send to china cdn the transfored path information.refreshCDN plugin need config the xml as follows: <\/a><\/p>\n

       <\/span><plugin<\/span> <\/span>name<\/span>=<\/span>\"refreshCDN\"<\/span>><\/span>

      - <\/span><localpath<\/span> <\/span>watch<\/span>=<\/span>\"\/data0\/htdocs\/cms.xoyo.com\/site\/\"<\/span>><\/span>

       <\/span><cdninfo<\/span> <\/span>domainname<\/span>=<\/span>\"ccms.chinacache.com\"<\/span> <\/span>port<\/span>=<\/span>\"80\"<\/span> <\/span>username<\/span>=<\/span>\"yourname\"<\/span> <\/span>passwd<\/span>=<\/span>\"yourpasswd\"<\/span> <\/span>\/><\/span>

       <\/span><sendurl<\/span> <\/span>base<\/span>=<\/span>\"http:\/\/pic.xoyo.com\/cms\"<\/span> <\/span>\/><\/span>

       <\/span><regexurl<\/span> <\/span>regex<\/span>=<\/span>\"false\"<\/span> <\/span>match<\/span>=<\/span>\"cms.xoyo.com\/site([\/a-zA-Z0-9]*).xoyo.com\/images\"<\/span> <\/span>\/><\/span>

       <\/span><\/localpath><\/span>

       <\/span><\/plugin><\/span><\/a><\/pre>\n

      As shown in the above xml, where plugin tag is used to call plug-ins,during the synchronization . Currently using refresh cdn plug-in “refreshCDN”, <\/a><\/p>\n

        <\/span><plugin<\/span> <\/span>name<\/span>=<\/span>\"refreshCDN\"<\/span> <\/span>start<\/span>=<\/span>\"true\"<\/span>\/><\/span><\/a><\/pre>\n

      that is, during the synchronization process, after synchronize the file to the remote server, will call refreshCDN plugin to refresh the china CDN(transform inotify event to china cdn interface protocol). If you do not want to use plugin function, set start attribute to false. If you need to use other plug-ins, see other plugin labels, change the plugin name to other plugin tag name,like socket or http. There are currently supports three plug-ins refreshCDN socket http. socket plug-in is to send inotify events to specify ip and port, http plug-in is to send (post) Inotify event to the specified domain name. <\/a><\/p>\n

      the watch attribute of localpath tag is the path being monitored,this will overlap the localpath tag in the sersync. <\/a><\/p>\n

      cdnifo tag specify the china cdn interface domain,port number,username and password,which are needed by china cdn. <\/a><\/p>\n

      sendurl tag is the url prefix <\/a><\/p>\n

      in the regexurl tag\uff0cif “regex” attribute is true\uff0cuse the string in the “match” attribute to regular match the path send by inotify\uff0cuse the string matched as part of the url which will be sent to china cdn. <\/a><\/p>\n

      for example\uff0cif inotify event is : <\/a><\/p>\n

      \/data0\/htdoc\/cms.xoyo.com\/site\/jx3.xoyo.com\/image\/a\/123.txt <\/a><\/p>\n

      after regular match, the path to send to cdn interface is : <\/a><\/p>\n

      http:\/\/pic.xoyo.com\/cms\/jx3\/a\/123.txt<\/tt>; <\/a><\/p>\n

      if regex attribute is set to false ,the path send to cdn interface is: <\/a><\/p>\n

      http:\/\/pic.xoyo.com\/cms\/jx3.xoyo.com\/images\/a\/123.txt<\/tt>; <\/a><\/p>\n

      socket and http plugin is very simple\uff0cjust specify the info in the xml. <\/a><\/p>\n

      execute<\/a><\/h1>\n

      synchronize or synchronize + plugin<\/a><\/h2>\n

      \u67e5\u770b\u5e2e\u52a9\u6587\u4ef6 (see the help) <\/a><\/p>\n

      .\/<\/span>sersync2<\/span>.<\/span>1<\/span> <\/span>-<\/span>h <\/span><\/a><\/pre>\n

      \u5728\u540c\u6b65\u7a0b\u5e8f\u5f00\u542f\u524d\u5bf9\u6574\u4e2a\u8def\u5f84\u4e0e\u8fdc\u7a0b\u670d\u52a1\u5668\u6574\u4f53\u540c\u6b65\u4e00\u904d (before the synchronization program working, rsync the whole monitor directory to remote server once) <\/a><\/p>\n

      .\/<\/span>sersync2<\/span>.<\/span>1<\/span> <\/span>-<\/span>r <\/span><\/a><\/pre>\n

      \u5f00\u542f\u5b88\u62a4\u8fdb\u7a0b\u6a21\u5f0f\uff0c\u5728\u540e\u53f0\u8fd0\u884c(Open the daemon mode, running in the background) <\/a><\/p>\n

      .\/<\/span>sersync2<\/span>.<\/span>1<\/span> <\/span>-<\/span>d<\/span><\/a><\/pre>\n

      \u6307\u5b9a\u914d\u7f6e\u6587\u4ef6\u540d\uff0c\u5982\u679c\u914d\u7f6e\u6587\u4ef6\u540d\u79f0\u4e0d\u662f confxml.xml\u8bf7\u4f7f\u7528’-o xxxxx.xml'(Specify the configuration file name, if the configuration file name is not confxml.xml use the ‘-o xxxxx.xml’) <\/a><\/p>\n

      .\/<\/span>sersync2<\/span>.<\/span>1<\/span> <\/span>-<\/span>o<\/span><\/a><\/pre>\n

      \u6307\u5b9a\u540c\u6b65\u5b88\u62a4\u7ebf\u7a0b\u6570\u91cf\uff0c\u9ed8\u8ba4\u4e3a10\u4e2a\uff0c\u9002\u7528\u4e8e\u73b0\u5728\u76844\u6838\u670d\u52a1\u5668\u3002\u5982\u679c\u9700\u589e\u52a0\u6216\u51cf\u5c11\u4f7f\u7528 ‘-n \u6570\u91cf’.(Specify the number of simultaneous daemon thread, the default is 10, applicable to the present four-core server. If you need to increase or reduce,please use ‘.\/sersync2.1 -n + num’ to run) <\/a><\/p>\n

      .\/<\/span>sersync2<\/span>.<\/span>1<\/span> <\/span>-<\/span>n<\/span><\/a><\/pre>\n

      \u901a\u5e38\u4f7f\u7528\u7684\u65b9\u6cd5\u662f : Commonly use following command to execute: <\/a><\/p>\n

      .\/<\/span>sersync2<\/span>.<\/span>1<\/span> <\/span>-<\/span>d <\/span>-<\/span>r<\/span><\/a><\/pre>\n

      run the plugin Only<\/a><\/h2>\n

      \u53ef\u4ee5\u4e0d\u8c03\u7528\u540c\u6b65\u7a0b\u5e8f\uff0c\u5f53\u6709inotify\u4e8b\u4ef6\u65f6\u5019\uff0c\u4e0d\u6267\u884c\u540c\u6b65\u7a0b\u5e8f\uff0c\u53ea\u8c03\u7528\u63d2\u4ef6\uff0c\u5f62\u5f0f\u5982\u4e0b\uff1a <\/a><\/p>\n

      when the inotify event arrive, you can run the plugin only, in this way ,the synchronization will not work.execute as follows: <\/a><\/p>\n

      run refresh cdn plugin only : <\/a><\/p>\n

      .\/<\/span>sersync2<\/span>.<\/span>1<\/span> <\/span>-<\/span>d  <\/span>-<\/span>m  refreshCDN<\/span><\/a><\/pre>\n

      run socket plugin only: <\/a><\/p>\n

      socket\u6a21\u5757\uff0c\u5f00\u542f\u8be5\u6a21\u5757\uff0c\u5219\u5411\u6307\u5b9aip\u4e0e\u7aef\u53e3\u53d1\u9001inotify\u6240\u4ea7\u751f\u7684\u6587\u4ef6\u8def\u5f84\u4fe1\u606f\uff1a <\/a><\/p>\n

      .\/<\/span>sersync2<\/span>.<\/span>1<\/span>  <\/span>-<\/span>d <\/span>-<\/span>m socket<\/span><\/a><\/pre>\n

      run Http plugin only <\/a><\/p>\n

      http\u6a21\u5757\u63a5\u53e3\uff0c\u53ef\u4ee5\u5411\u6307\u5b9a\u57df\u540d\u7684\u4e3b\u673apost,inotify\u76d1\u63a7\u7684\u4e8b\u4ef6: <\/a><\/p>\n

      .\/<\/span>sersync2<\/span>.<\/span>1<\/span> <\/span>-<\/span>d <\/span>-<\/span>m http<\/span><\/a><\/pre>\n

      log file description<\/a><\/h1>\n

      \u5728\u6267\u884c\u7684\u8fc7\u7a0b\u4e2d\uff0c\u4f1a\u4ea7\u751frsync_fail_log.sh\u6587\u4ef6\uff0c\u5728\u540c\u6b65\u7684\u8fc7\u7a0b\u4e2d\uff0c\u5982\u679c\u9700\u8981\u540c\u6b65\u7684\u6587\u4ef6\u5931\u8d25\u4e86\u4f1a\u5148\u8fdb\u91cd\u4f20\u961f\u5217\uff0c\u5982\u679c\u518d\u6b21\u5931\u8d25\u5c06\u88ab\u8bb0\u5f55\u5728 rsync_fail_log.sh\u6587\u4ef6\uff0c\u8be5\u6587\u4ef6\u4f1a\u6bcf10\u4e2a\u5c0f\u65f6\u81ea\u52a8\u6267\u884c\u4e00\u6b21\uff0c\u5e76\u88ab\u91cd\u65b0\u6e05\u7a7a\u3002\u5982\u679c\u8c03\u7528\u5237\u65b0cdn\u63a5\u53e3\uff0c\u6267\u884c\u8fc7\u7a0b\u4f1a\u4ea7\u751f error.log\u6587\u4ef6\uff0c\u8bb0\u5f55\u4ececdn\u63a5\u6536\u5230\u7684\u4fe1\u606f\uff0c\u5e76\u4e14\u8bb0\u5f55\u5237\u65b0\u7684\u8def\u5f84\u3002 <\/a><\/p><\/blockquote>\n

      In the implementation process, will produce rsync_fail_log.sh files, which record the file fail to rsync,the rsync_fail_log.sh will execute every 10 hours,and will be cleared after executed.If you call refresh cdn plugin, the implementation process will produce error.log file, records the information received from the cdn, and record the path refreshed. <\/a><\/p><\/blockquote>\n

      appendix<\/a><\/h1>\n

      the script program can not filter the inotify event that we don’t use. if we vi a file “test”,will generate inotify events as follows: <\/a><\/p>\n

      <\/a><\/p><\/blockquote>\n

      in my progam ,only add one event to the queue after the filter,so it can save lots of synchronization time and network resource. detail info see the blog: <\/a> <\/p>\n

      http:\/\/hi.baidu.com\/johntech\/blog\/item\/e4a31a3db1ee1ce755e723f4.html<\/a> <\/p><\/blockquote>\n

      \u4e3a\u4ec0\u4e48\u811a\u672c\u76d1\u63a7\u6548\u7387\u4f4e? \u56e0\u4e3a\u811a\u672c\u76d1\u63a7\uff0c\u5373\u4f7f\u4f7f\u7528–exclude\u6b63\u5219\u8bed\u6cd5\u4e5f\u65e0\u6cd5\u8fc7\u6ee4\u6389\u4e00\u4e9b\u6587\u4ef6\u7cfb\u7edf\u4ea7\u751f\u7684\u4e34\u65f6\u6587\u4ef6\u548c\u4e34\u65f6\u4e8b\u4ef6\uff0c \u9020\u6210rsync\u53cd\u590d\u6267\u884c\uff0c\u8be6\u7ec6\u6587\u7ae0\u5982\u4e0b: <\/p>\n

      http:\/\/hi.baidu.com\/johntech\/blog\/item\/e4a31a3db1ee1ce755e723f4.html<\/a> <\/p>\n

      +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ <\/p>\n

      sersync2.5beta1<\/a><\/h2>\n

      1.\u4fee\u6539sersync2.4\u4e2d\uff0c\u5982\u679c\u4f7f\u7528–password-file\u5e26\u5bc6\u7801\u540c\u6b65\uff0c\uff0dr \u6ca1\u6709\u8c03\u7528 –password-file,\u5bf9\u6e90\u4e0e\u76ee\u7684\u6574\u4f53\u540c\u6b65\u4e00\u904dbug <\/a><\/p>\n

      2.\u5c06\u542f\u52a8\u63d0\u793a\u57fa\u672c\u6539\u4e3a\u82f1\u6587\u3002 <\/a><\/p>\n

      3.\u53ef\u4ee5\u4f7f\u7528delete\u6807\u7b7e\u6307\u5b9a\u662f\u5426\u5bf9\u672c\u5730\u7684 delete\u4e8b\u4ef6\u8fdb\u884c\u76d1\u63a7\u3002 <\/a><\/p>\n

      4. rsync.fail.log.sh \u4f1a\u8bb0\u5f55\u8c03\u7528rsync\u9519\u8bef\u53f7\uff0c\u4fbf\u4e8e\u4ee5\u540e\u6539\u8fdb\u3002 <\/a><\/p>\n

      5.\u6539\u6389\u672c\u5730host ip \u4e0e\u8fdc\u7a0b remote ip \u76f8\u540c\u65f6\u5019\uff0c\u4e0d\u8fdb\u884c\u540c\u6b65\u7684\u9650\u5236\u3002\u73b0\u5728\u53ef\u4ee5\u5c06\u672c\u5730\u4e0e\u8fdc\u7a0b\u90fd\u8bbe\u4e3a127.0.0.1\u8fdb\u884c\u672c\u673a\u540c\u6b65\u4e86\uff0c\u65e0\u987b\u628a\u5176\u4e2d\u4e00\u4e2a\u8bbe\u7f6e\u4e3alocalhost. <\/a><\/p>\n

      +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ <\/a><\/p>\n

      sersync2.4<\/a><\/h2>\n

      \u4fee\u6b63\u91cd\u5927 bug\uff0c\u5f53\u5220\u9664\u4e00\u6b21\u6587\u4ef6\u540e\uff0c\u65e0\u6cd5\u540c\u6b65\u7684\u9519\u8bef\uff0c\u8fd9\u4e2a\u9519\u8bef\u5728\u4f4e\u7248\u672c\u7684sersync\u90fd\u5b58\u5728\uff0c\u62b1\u6b49\u3002 <\/a><\/p>\n

      \u589e\u52a0debug\u529f\u80fd\uff0c\u53ef\u4ee5\u5f00\u542fdebug\u770b\u540c\u6b65\u7684\u6587\u4ef6 <\/a><\/p>\n

      +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ <\/a><\/p>\n

      sersync2.3<\/a><\/h2>\n

      \u4fee\u6b63\u540c\u6b65\u6587\u4ef6\u540d\u4e2d\u5b58\u5728’$’ ‘(‘ ‘)’\u7b49\u9700\u8981\u8f6c\u4e49\u5b57\u7b26\u65f6\u53d1\u751f\u9519\u8bef\u7684\u60c5\u51b5\u3002 <\/a><\/p>\n

      \u589e\u52a0\u5bc6\u7801\u540c\u6b65\u529f\u80fd\u3002 <\/a><\/p>\n

      \u589e\u52a0\u6587\u4ef6\u8fc7\u6ee4\u529f\u80fd\uff0c\u53ef\u4ee5\u81ea\u5b9a\u4e49\u4efb\u610f\u6761\u8fc7\u6ee4\u89c4\u5219\u3002 <\/a><\/p>\n

      \u8bf8\u5982 \u8981\u8fc7\u6ee4*<\/tt>.php \u6216\u8005dirname1\/*<\/tt>\u4e4b\u7c7b\u7684\u6587\u4ef6,\u53ea\u9700\u5728\u914d\u7f6e\u6587\u4ef6\u4e2d\u586b\u5199\u8be5\u6b63\u5219\u8868\u8fbe\u5373\u53ef\u3002 <\/a><\/p>\n

      +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ <\/a><\/p>\n

      sersync2.2<\/a><\/h2>\n

      \u53bb\u9664curl\u5e93\uff0c\u57fa\u672c\u4e0a\u7f16\u8bd1\u53ea\u4f9d\u8d56\u6807\u51c6\u5e93\uff0c\u6682\u65f6\u53bb\u9664http\u63d2\u4ef6\u7684\u529f\u80fd\u3002 <\/a><\/p>\n<\/div>\n

      \n
      <\/div>\n
      <\/div>\n","protected":false},"excerpt":{"rendered":"

      Introduce: http:\/\/code.google.com\/p\/sersync\/ sersync\u4e3b\u8981\u7528 … \u7ee7\u7eed\u9605\u8bfbsersync\u4e3b\u8981\u7528\u4e8e\u670d\u52a1\u5668\u540c\u6b65\uff0cweb\u955c\u50cf\u7b49\u529f\u80fd<\/span> →<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"http:\/\/wp.imkylin.cn\/wp-json\/wp\/v2\/posts\/301"}],"collection":[{"href":"http:\/\/wp.imkylin.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/wp.imkylin.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/wp.imkylin.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/wp.imkylin.cn\/wp-json\/wp\/v2\/comments?post=301"}],"version-history":[{"count":0,"href":"http:\/\/wp.imkylin.cn\/wp-json\/wp\/v2\/posts\/301\/revisions"}],"wp:attachment":[{"href":"http:\/\/wp.imkylin.cn\/wp-json\/wp\/v2\/media?parent=301"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/wp.imkylin.cn\/wp-json\/wp\/v2\/categories?post=301"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/wp.imkylin.cn\/wp-json\/wp\/v2\/tags?post=301"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}