• rsync+sersync实时同步


    A: 运行rsync daemon
    B: 运行sersync ,会监控目录,发现改变会更新推送到A上

    rsync见上面rsync设置

    sersync安装配置
    1.建立目录
    mkdir -p /opt/sersync/{bin,conf,log}
    2. 下载解压sersync
    wget http://sersync.googlecode.com/files/sersync2.5_64bit_binary_stable_final.tar.gz
    tar xvf sersync2.5_64bit_binary_stable_final.tar.gz
    3. 拷贝二进制文件和配置文件
    cd GNU-Linux-x86
    cp confxml.xml /opt/sersync/conf
    cp sersync2 /opt/sersync/bin
    4. 修改配置文件
    confxml.xml

    <?xml version="1.0" encoding="ISO-8859-1"?>
    <head version="2.5">
    <host hostip="localhost" port="8008"></host><!-- listen ip and port -->
    <debug start="false"/> <!-- debug default off-->
    <fileSystem xfs="false"/>
    <filter start="false"> <!-- exclude filter,default off -->
    <exclude expression="(.*).svn"></exclude>
    <exclude expression="(.*).gz"></exclude>
    <exclude expression="^info/*"></exclude>
    <exclude expression="^static/*"></exclude>
    </filter>
    <inotify> <!--monitor event -->
    <delete start="false"/>
    <createFolder start="true"/>
    <createFile start="false"/>
    <closeWrite start="true"/>
    <moveFrom start="true"/>
    <moveTo start="true"/>
    <attrib start="false"/>
    <modify start="false"/>
    </inotify>

    <sersync>
    <localpath watch="/tmp"> <!-- local file watch -->
    <remote ip="192.168.1.111" name="test"/> <!-- remote ip and module name -->
    <!--<remote ip="192.168.8.39" name="tongbu"/>-->
    <!--<remote ip="192.168.8.40" name="tongbu"/>-->
    </localpath>
    <rsync>
    <commonParams params="-avzP"/> <!-- rsync parmas -->
    <auth start="true" users="linuxsir" passwordfile="/etc/rsync.pass"/> <!-- auth user and file -->
    <userDefinedPort start="false" port="874"/><!-- port=874 --> <!-- use custom define port -->
    <timeout start="false" time="100"/><!-- timeout=100 --> <!-- time out define,default off -->
    <ssh start="false"/> <!--- use ssh crypt to transfer,default off -->
    </rsync>
    <failLog path="/opt/sersync/log/rsync_fail_log.sh" timeToExecute="60"/><!--default every 60mins execute once-->
    <crontab start="false" schedule="600"><!--600mins--><!-- use crontab to transfer,default off -->
    <crontabfilter start="false">
    <exclude expression="*.php"></exclude>
    <exclude expression="info/*"></exclude>
    </crontabfilter>
    </crontab>
    <plugin start="false" name="command"/> <!-- after finish rsync tast to execute the plugin after define -->
    </sersync>
    <!-- plugin examples -->
    <plugin name="command">
    <param prefix="/bin/sh" suffix="" ignoreError="true"/> <!--prefix /opt/tongbu/mmm.sh suffix-->
    <filter start="false">
    <include expression="(.*).php"/>
    <include expression="(.*).sh"/>
    </filter>
    </plugin>
    <plugin name="socket">
    <localpath watch="/opt/tongbu">
    <deshost ip="192.168.138.20" port="8009"/>
    </localpath>
    </plugin>
    <plugin name="refreshCDN">
    <localpath watch="/data0/htdocs/cms.xoyo.com/site/">
    <cdninfo domainname="ccms.chinacache.com" port="80" username="xxxx" passwd="xxxx"/>
    <sendurl base="http://pic.xoyo.com/cms"/>
    <regexurl regex="false" match="cms.xoyo.com/site([/a-zA-Z0-9]*).xoyo.com/images"/>
    </localpath>
    </plugin>
    </head>

    5. 运行
    sersync2 -r -d -o /opt/sersync/conf/confxml.xml
    option: -r rsync all the local files to the remote servers before the sersync work
    option: -d run as a daemon
    option: -o config xml name: /opt/sersync/conf/confxml.xml
    6. 测试
    /tmp建立文件,测试能否传上去

  • 相关阅读:
    c# 扩展方法奇思妙用高级篇八:Type类扩展
    Asp.Net 上传大文件专题
    波形捕捉:(2)创建捕捉设备对象
    Capturing Waveforms【译】
    波形捕捉:(1)枚举"捕捉设备"
    C# 调用sql 2000存储过程
    HTTP请求流程(一)流程简介
    Asp.Net 上传大文件专题(4)利用ajax技术显示上传进度
    c# GDI+简单绘图(四)
    波形捕捉:(5)“捕捉缓冲区”信息
  • 原文地址:https://www.cnblogs.com/cmsd/p/3648685.html
Copyright © 2020-2023  润新知