Environmental introduction
System Kernel  : 2.6.-642.4..el6.x86_64
Source Server : 192.168.7.1
Target Server : 192.168.7.10
Target Server Configure
1、Close SElinux
sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config
setenforce
2、configure iptables server
iptables -A INPUT -p tcp --dport  -j ACCEPT
iptables -A OUTPUT -p tcp --sport -j ACCEPT
/etc/init.d/iptables save
/etc/init.d/iptables restart
3、Install Rsync server software
yum -y install rsync xinetd
sed -n s/"disable.*= yes"/"disable = no"/p /etc/xinetd.d/rsync
sed -n 's/server_args.* = --daemon/server_args = --daemon --config=\/etc\/rsyncd.conf/p' /etc/xinetd.d/rsync
/etc/init.d/xinetd start
4、Create rsync configuration file and configure
touch /etc/rsyncd.conf
cat >> /etc/rsyncd.conf << END
log file = /var/log/rsyncd/rsyncd.log
pidfile = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
secrets file = /etc/rsync.pass
motd file = /etc/rsyncd.Motd
[vick1]
path = /home/vick1
comment = vick1
uid = root
pid = root
port
use chroot = no
read only = no
list = no
max connections =
timeout =
auth users = vick
hosts allow = 192.168.7.1
END
5、Create user authentication file
touch /etc/rsync.pass
echo "vick:123456" >> /etc/rsync.pass
6、Set files permissions
chmod  /etc/rsync.pass
chmod /etc/rsyncd.conf
7、start-up rsync
/etc/init.d/xinetd start
Source server rsync client configure
1、Close SElinux

sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config
setenforce 0

2、configure iptables server
iptables -A INPUT -p tcp --dport  -j ACCEPT
iptables -A OUTPUT -p tcp --sport -j ACCEPT
/etc/init.d/iptables save
/etc/init.d/iptables restart

3、Install Rsync server software
yum -y install rsync xinetd
sed -n s/"disable.*= yes"/"disable = no"/p /etc/xinetd.d/rsync
/etc/init.d/xinetd start
4、create password file
touch /etc/sync.pass
echo "" >> /etc/sync.pass
chmod /etc/sync.pass
5、Test single point synchronization
rsync -avH --port=873 --progress --delete  /home/vick1/  vick@192.168.7.10::vick1 --password-file=/etc/sync.pass
Install sersync tools real time trigger Rsync synchronization
1、Check whether the server kernel supports inotify
-rw-r--r-- 1 root root 0 May  2 14:33 max_queued_events
-rw-r--r-- 1 root root 0 May 2 14:33 max_user_instances
-rw-r--r-- 1 root root 0 May 2 14:33 max_user_watches

Notes: Make a list of three documents that show the kernel supports inotify

2、 Modify kernel parameters
cat >> /etc/sysctl.conf << END
fs.inotify.max_queued_events=
fs.inotify.max_user_watches=
fs.inotify.max_user_instances=
END
sysctl -p
Notes:
Max_queued_events:inotify queue maximum length, if the value is too small, there will be * * * Event Overflow * * error,
resulting in inaccurate monitoring files Queue
max_user_watches:The number of files to synchronize,can use find /home/vick1 -type d|wc -l statistics,
must ensure that the max_user_watches value is greater than the statistical results
max_user_instances:Create maximum value of inotify instance for each user
 3、Install and configure sersync services 
Download sersync software
wget https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/sersync/sersync2.5.4_64bit_binary_stable_final.tar.gz --no-check-certificate
tar -zxvf sersync2..4_64bit_binary_stable_final.tar.gz
mv GNU-Linux-x86 /usr/local/sersync

  Configure sersync services

Configure an instance and specify a synchronization directory,user and password

cp /usr/local/sersync/confxml.xml /usr/local/sersync/confxml.xml.bak 
vim /usr/local/sersync/confxml.xml <?xml version="1.0" encoding="ISO-8859-1"?>
<head version="2.5">
<host hostip="localhost" port=""></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="/home/vick1">
<remote ip="192.168.7.10" name="vick1"/>
<!--<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="vick" passwordfile="/etc/sync.pass"/>
<userDefinedPort start="false" port=""/><!-- port= -->
<timeout start="true" time=""/><!-- timeout= -->
<ssh start="false"/>
</rsync>
<failLog path="/usr/local/sersync/logs/rsync_fail_log.sh" timeToExecute=""/><!--default every 60mins execute once-->
<crontab start="false" schedule=""><!--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=""/>
</localpath>
</plugin>
<plugin name="refreshCDN">
<localpath watch="/data0/htdocs/cms.xoyo.com/site/">
<cdninfo domainname="ccms.chinacache.com" port="" 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> /usr/local/sersync/sersync2 -d -r -o  /usr/local/sersync/confxml.xml

  The final test is successful synchronization,The configuration is over here

Extand:
Add script to monitor whether sersync is running properly
touch /home/script/chech_sersync.sh

cat >> /home/script/chech_sersync.sh << END
#!/bin/sh sersync="/usr/local/sersync/sersync2" confxml="/usr/local/sersync/confxml.xml" status=$(ps aux |grep 'sersync2'|grep -v 'grep'|wc -l) if [ $status -eq ]; then $sersync -d -r -o $confxml & else exit ; fi
END
 
 
 
 

 
 
 
 

rsync+sersync的更多相关文章

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

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

  2. rsync+sersync实现文件实时同步

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

  3. Rsync+sersync文件实时同步

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

  4. rsync+sersync实现数据文件实时同步

    一.简介 sersync是基于Inotify开发的,类似于Inotify-tools的工具: sersync可以记录下被监听目录中发生变化的(包括增加.删除.修改)具体某一个文件或某一个目录的名字: ...

  5. 如何通过rsync+sersync 实现同步备份

    3.rsync+sersync更快更节约资源实现web数据同步4.unison+inotify实现web数据双向同步 一:为什么要实现同步备份 服务器上有些重要文件或数据时,可以把他们多备份一份到其他 ...

  6. Rsync + sersync 实时同步备份

    一      Rsync + Sersync  实时同步介绍 1.Rsync 服务搭建介绍 云机上搭建Rsync server,在本地搭建Rsync Clinet. 2. Sersync 服务搭建介绍 ...

  7. rsync+sersync实现代码同步

    APP02安装 rsync服务端 yum install rsync vim /etc/rsyncd.conf pid file=/var/rsynclog/rsyncd.pid log file=/ ...

  8. Rsync + Sersync 实现数据增量同步

    部分引用自:https://blog.csdn.net/tmchongye/article/details/68956808 一.什么是Rsync? Rsync(Remote Synchronize) ...

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

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

  10. Rsync+sersync实现数据实时同步

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

随机推荐

  1. Java 虚拟机 - 2.3 HotSpot虚拟机对象

    对象的创建 Step1 类加载检查 当发现一条new指令时,检查: 该指令的参数是否能在常量池中定位到一个类的符号引用: 并且检查这个符号引用代表的类是否已经被加载.解析和初始化过.如果没有,那必须先 ...

  2. 【JZOJ6375】华灵[蝶妄想]

    description analysis 明显括号序长度是偶数,如果其中一个是奇数,那么只能让这奇数行或列是括号序 对于两个都是偶数,需要分类讨论,假设\(n<m\) 有一种是牺牲掉\(n\ov ...

  3. Idea jsp页面乱码

    jsp页面中添加 <%@ page language="java" contentType="text/html; charset=utf-8" page ...

  4. 把云数据库带回家!阿里云发布POLARDB Box数据库一体机

    9月26日,2019杭州云栖大会上,阿里云宣布正式推出高性能数据库一体机——POLARDB Box,用户部署在自有数据中心即可享受云数据库的便捷体验,同时还为Oracle等传统数据库用户提供一键迁移功 ...

  5. 字符串——cf1109B

    /* 先判不可行的情况:n/2的是单一字符 判只切割一次能不能组成回文 枚举每个切割点,交换两个串的位置 剩下就是割两次 */ #include<bits/stdc++.h> #inclu ...

  6. Spring+Mybatis常见问题随笔

    错误1:无法绑定指定方法 异常堆栈:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found) 原因 ...

  7. Python 函数与内置函数

    1.函数的基本定义 def 函数名称(参数) 执行语句 return 返回值 def : 定义函数的关键字: 函数名称:顾名思义,就是函数的名字,可以用来调用函数,不能使用关键字来命名,做好是用这个函 ...

  8. substring常用的两种方法

    1.public String substring(int beginIndex, int endIndex) 第一个参数int为开始的索引,对应String数字中的开始位置, 第二个参数是截止的索引 ...

  9. 【默默努力】h5-game-heroVSmonster

    先放下作者大大的项目地址:https://github.com/yangyunhe369/h5-game-heroVSmonster 然后游戏的效果为 截动图的按键与游戏按键应该冲突,我就截几张图片了 ...

  10. 代码风格JavaScript standard style与Airbnb style

    代码风格JavaScript  standard style与Airbnb style