zoukankan      html  css  js  c++  java
  • sersync部署

    rsync :  wget  http://rsync.samba.org/ftp/rsync/src/rsync-3.1.1.tar.gz

    Sersync: wget https://raw.githubusercontent.com/wsgzao/sersync/master/sersync2.5.4_64bit_binary_stable_final.tar.gz

    Sersync 安装:

    tar zxf sersync2.5.4_64bit_binary_stable_final.tar.gz

    mv GNU-Linux-x86 /usr/local/sersync

    客户端rsync部署:

    RSYNC 部署: tar xf rsync-3.1.1.tar.gz
    ./config
    Make && make install
    配置文件:vim /etc/rsyncd.conf
    uid=root
    gid=root
    max connections=36000
    use chroot=yes
    log file=/var/log/rsyncd.log
    ignore errors = yes
    read only = no
    auth users = root
    secrets file = /etc/rsync.pass   #rsync 客户端配置, 格式为:  root:klg2go  权限为 600
    [rsync]  #服务器端需对应的模块名
    comment  = rsync
    path=/data/koala_ira   #同步到此目录
    配置文件: vim /etc/rsync.pass
    root:klg2go
    启动rsync :   rsync --daemon --config /etc/rsyncd.conf

    服务器端(同步端)
    sersync部署

    vim /usr/local/sersync/conf/confxml.xml
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <head version="2.5">
        <host hostip="localhost" port="8008"></host>
        <debug start="false"/>
        <fileSystem xfs="false"/>
        <filter start="false">
            <exclude expression="(.*).svn"></exclude>
            <exclude expression="(.*).gz"></exclude>
            <exclude expression="^info/*"></exclude>
            <exclude expression="^static/*"></exclude>
        </filter>
        <inotify>
            <delete start="true"/>
            <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="/data/koala_ira/">  //服务器端需要同步过去的目录
                <remote ip="183.6.104.133" name="rsync"/>  // 客户端的IP地址和模块名,和上面rsync对应
                <!--<remote ip="192.168.8.39" name="tongbu"/>-->
                <!--<remote ip="192.168.8.40" name="tongbu"/>-->
            </localpath>
            <rsync>
                <commonParams params="-artuz"/>
                <auth start="true" users="root" passwordfile="/usr/local/sersync/user.pass"/>  //start 需要为 true 才同步  同步到客户端,用到的账号和密码,需和客户端一致
                <userDefinedPort start="false" port="874"/><!-- port=874 -->
                <timeout start="false" time="100"/><!-- timeout=100 -->
                <ssh start="false"/>
            </rsync>
            <failLog path="/tmp/rsync_fail_log.sh" timeToExecute="60"/><!--default every 60mins execute once-->
            <crontab start="false" schedule="600"><!--600mins-->
                <crontabfilter start="false">
                    <exclude expression="*.php"></exclude>
                    <exclude expression="info/*"></exclude>
                </crontabfilter>
            </crontab>
            <plugin start="false" name="command"/>
        </sersync>
        <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>
    编辑sersync 密码文件:
        Vim /usr/local/sersync/user.pass
        klg2go
    启动 sersync : 
    sersync2 -r -d -o /usr/local/sersync/conf/confxml.xml  > /var/log/sersync/rsync.log 2>&1 &

    另一台服务器按照改服务器相互配置即可做成相互同步: PS:同步时候注意选到目录,如果目录为空将会把对面同步的目录文件也清空。

  • 相关阅读:
    Linux服务器免密登录设置
    Docker 批量停止、删除容器和镜像
    python破解wifi密码
    python调用paramiko模块连接服务器
    Docker搭建redis-cluster集群三主三备
    Centos7.7搭建Prometheus2.0+Grafana监控Docker容器
    Centos7.7部署fastdfs分布式文件系统
    拉取git代码仓库项目到本地
    Seafile对接Amazon S3存储后端
    Centos7.x部署SeaFile私有网盘
  • 原文地址:https://www.cnblogs.com/cp-miao/p/7205914.html
Copyright © 2011-2022 走看看