APP02安装 rsync服务端
yum install rsync

vim /etc/rsyncd.conf

pid file=/var/rsynclog/rsyncd.pid
log file=/var/rsynclog/rsyncd.log
lock file=/var/rsynclog/rsync.lock
motd file=/etc/rsyncd.motd
port=873
address=10.10.1.56
hosts allow=10.10.1.35
#hosts deny=0.0.0.0/0
uid=heron
gid=heron
max connections=10 read only=no
list=yes ###密码文件
secrets file=/etc/rsyncd.secrets
### 有需要可以添加多个目录
[dist]
comment=rsync dist directory
path=/home/heron/www/dist [yadmin]
comment=rsync yadmin directory
path=/home/heron/www/yadmin [miniapp]
comment=rsync miniapp directory
path=/home/heron/www/miniapp

cat /etc/rsyncd.secrets ### 两台服务器密码文件的权限设置为600

heron:RD18v1Fx831AIrROo

启动并设置开机自启动

systemctl start rsyncd
systemctl enable rsyncd
APP01安装rsync+sersync(代码所在服务器)
yum install rsync

vim /etc/rsyncd.secrets

heron:RD18v1Fx831AIrROo

安装sersync并配置

tar fxzsersync2.5.4_64bit_binary_stable_final.tar.gz -C /usr/local/
cd /usr/local/
mv GNU-Linux-x86 sersync
vim sersync/confxm.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="true">
<exclude expression="(.*)\.git"></exclude>
<exclude expression="(.*)\.log"></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="/home/heron/www/dist">
<remote ip="10.10.1.56" name="dist"/>
<!--<remote ip="192.168.8.39" name="tongbu"/>-->
<!--<remote ip="192.168.8.40" name="tongbu"/>-->
</localpath> <rsync>
<commonParams params="-auz"/>
<auth start="true" users="heron" passwordfile="/etc/rsync.secrets"/>
<userDefinedPort start="false" port="874"/><!-- port=874 -->
<timeout start="true" time="100"/><!-- timeout=100 -->
<ssh start="false"/>
</rsync>
<failLog path="/usr/local/sersync/logs/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>

启动,可以配置多个文件启动

-d参数表示放到后台、-r表示先进行一次完整同步,-o表示指向某个配置文件,注意:配置文件配置了忽略文件的话,启动方式不可以带r参数

/usr/local/sersync/sersync  -dro /usr/local/sersync/dict_confxml.xml

rsync+sersync实现代码同步的更多相关文章

  1. Rsync+Sersync数据实时同步(双向)

    Rsync+Sersync数据实时同步(双向) 服务介绍 一.为什么要用rsync+sersync架构? 1.sersync是基于inotify开发的,类似于inotify-tools的工具 2.se ...

  2. Rsync+sersync文件实时同步

    一.为什么要用Rsync+sersync架构1.sersync是基于Inotify开发的,类似于Inotify-tools的工具2.sersync可以记录下被监听目录中发生变化的(包括增加.删除.修改 ...

  3. centos6.6配置rsync+sersync实现实时同步分布式多客户端分发同步

    1.sersync项目: sersync项目利用inotify与rsync技术实现对服务器数据实时同步到解决方案,其中inotify用于监控sersync所在服务器上文件系统的事件变化,rsync是目 ...

  4. Rsync+sersync实现实时同步

    介绍: sersync主要用于服务器同步,web镜像等功能.基于boost1.43.0,inotify api,rsync command.开发.目前使用的比较多的同步解决方案是inotify-too ...

  5. rsync+sersync多线程实时同步

    一.sersync优点 1)使用c++编写,对linux系统文件产生的临时文件和重复文件操作会进行过滤,在结合rsync同步的时候,会减少运行时消耗的本地及网络资源,因此速度更快. 2)相比较inot ...

  6. rsync+sersync实现文件同步

    一.目的 A服务器:11.11.11.11 源服务器 B服务器:22.22.22.22 目标服务器,既同步备份的目标 将A服务器的文件同步到B服务器上 二.rsync环境部署 1.关闭selinux, ...

  7. rsync+sersync+inotify实现服务器间文件同步之一

    rsync+sersync+inotify实现服务器间文件同步之一:rsync安装配置 2013年12月14日 ⁄ Linux管理, 服务器集群技术 ⁄ 共 4925字 ⁄ rsync+sersync ...

  8. Rsync+sersync(inotify)实现数据实时双向同步

    目录 Rsync+Sersync数据实时同步(双向) 服务介绍 节点声明 编译环境配置 安装Rsync 编辑Rsync配置文件 配置文件解析 配置密码文件 启动rsync验证 安装sersync服务 ...

  9. Linux下Rsync+sersync实现数据实时同步

    inotify 的同步备份机制有着缺点,于是看了sersync同步,弥补了rsync的缺点.以下转自:http://www.osyunwei.com/archives/7447.html 前言: 一. ...

随机推荐

  1. 消除 ASP.NET Core 告警 "No XML encryptor configured. Key may be persisted to storage in unencrypted form"

    在 ASP.NET Core 中如果在 DataProtection 中使用了 PersistKeysToFileSystem 或 PersistKeysToFileSystem services.A ...

  2. C#获取项目程序及运行路径的方

    1.asp.net webform用“Request.PhysicalApplicationPath获取站点所在虚拟目录的物理路径,最后包含“\”:   2.c# winform用 A:“Applic ...

  3. transform:translate(-50%,-50%)实现水平垂直居中

    .content {    padding:10px;    background:green;    color:#fff;    position:absolute;    top:50%;    ...

  4. python遍历文件

    #!/usr/local/bin/python # -*- coding: UTF-8 -*- #coding:gbk import re import os rootdir = 'src' def ...

  5. [开发笔记]--把input框设置成font-size:0埋下的坑。

    vue项目上开发了一个输入pin码的组件.在某些安卓机器上.用户点击键盘后会自动失去焦点自动收起键盘.经过排查,发现是css属性font-size设置成0导致的.

  6. react-devtool 消息处理渲染 源码理解

    react-devtools 有chrome插件版,但在chrome 插件下的通信调试不够透明,且chrome 的插件特别是开发工具界面几乎无法调试. 看到了react-devtools 也提供ele ...

  7. C语言扫盲及深化学习

    c语言特点: (1)效率高 (2)控制性强 (3)硬件亲和性好 (4)可移植性高 一.关于注释 c语言中注释不能嵌套,因此注释代码时一定要注意源代码中是否已经存在注释.要从逻辑上删除一段代码,利用预编 ...

  8. Scala中 zip或者zipWithIndex的用法

    问题:你要遍历一个有序集合,同时你又想访问一个循环计数器,但最重要的是你真的不需要手动创建这个计数器.解决方案:    使用zipWithIndex或者zip方法来自动地创建一个计数器,假设你有一个有 ...

  9. 使用TCP模拟登陆

    import java.util.ArrayList;import java.util.List; public class UserDB { //使用Map存储账号密码 private static ...

  10. IdeaJ 常见插件安装, 常用配置,常用快捷键

    -- 系统是 Ubuntu 16.04 1, 插件: 2, 常见的设置: [1] 代码提示的修改: File --> settings --> Keymap --> MainMenu ...