运维开发网

sersync实时监控同步

运维开发网 https://www.qedev.com 2020-06-19 13:53 出处:网络
sersync实时监控同步:先安装inotify+rsync 下载获取软件: yum install -y inotify-tools

sersync实时监控同步:先安装inotify+rsync

  1. 下载获取软件:
    • yum install -y inotify-tools
    • https://github.com/wsgzao/sersync   下载软件包

2.上传软件到linux系统

yum install -y lrzsz

    • rz -y  Windows上传数据到Linux(过程只需要点点点)
    • sz -y   Linux数据上传到Windows

3.安装部署sersync(二进制包):

    1. unzip sersync_installdir_64bit.zip
    • cp -a /server/tools/sersync_installdir_64bit/sersync/ /usr/local/

4.修改配置文件:

    • vim /usr/local/sersync/conf/confxml.xml
    • 6 <filter start="false">

      7 <exclude expression="(.*)\.svn"></exclude>

      8 <exclude expression="(.*)\.gz"></exclude>

      9 <exclude expression="^info/*"></exclude>

      10 <exclude expression="^static/*"></exclude>

      11 </filter>

      说明:指定监控的事件信息

      12 <inotify>

      13 <delete start="true"/>

      14 <createFolder start="true"/>

      15 <createFile start="false"/>

      16 <closeWrite start="true"/>

      17 <moveFrom start="true"/>

      18 <moveTo start="true"/>

      19 <attrib start="false"/>

      20 <modify start="false"/>

      21 </inotify>

      重点说明:实现实时同步关键配置

      24 <localpath watch="/opt/tongbu">

      25 <remote ip="127.0.0.1" name="tongbu1"/>

      26 <!--<remote ip="192.168.8.39" name="tongbu"/>-->

      27 <!--<remote ip="192.168.8.40" name="tongbu"/>-->

      28 </localpath>

      29 <rsync>

      30 <commonParams params="-artuz"/>

      31 <auth start="false" users="root" passwordfile="/etc/rsync.pas"/>

      32 <userDefinedPort start="false" port="874"/><!-- port=874 -->

5.启动实时同步服务,检查测试:

    • chmod +x /usr/local/sersync/bin/sersync

      # ln -s /usr/local/sersync/bin/sersync /usr/local/sbin/sersync

      # ll /usr/local/sbin/sersync

      lrwxrwxrwx 1 root root 30 Jul 21 00:28 /usr/local/sbin/sersync -> /usr/local/sersync/bin/sersync

      命令重要参数: 参数-d: 启用守护进程模式 参数-r: 在监控前,将监控目录与远程主机用rsync命令推送一遍 参数-o: 指定配置文件,默认使用confxml.xml文件 /usr/local/sersync/conf/confxml.xml /usr/local/sersync/conf/confxml01.xml /usr/local/sersync/conf/confxml02.xml sersync -dro /usr/local/sersync/conf/confxml.xml 实时同步软件:lrsync实时同步 利用实时同步可以解决 nfs服务单点问题

0

精彩评论

暂无评论...
验证码 换一张
取 消