RedHat Linux下利用sersync进行实时同步数据
拓扑图如下:
[root@server10 ~]#wget http://rsync.samba.org/ftp/rsync/src/rsync-3.0.9.tar.gz
[root@server10 ~]#tar xzf rsync-3.0.9.tar.gz
[root@server10 ~]#cd rsync-3.0.9
[root@server10 rsync-3.0.9]#./configure
[root@server10 rsync-3.0.9]#make && make install
默认会安装到/usr/local/bin/rsync ,所以我们要把/usr/bin下面的rsync备份一次删除或重命名,然后做一个软连接到/usr/local/bin/rsync
[root@server10 rsync-3.0.9]#ln -s /usr/local/bin/rsync rsync
查看版本,即为升级后的版本
[root@server10 book]# rsync --version
rsync version 3.0.9 protocol version 30
Copyright (C) 1996-2011 by Andrew Tridgell, Wayne Davison, and others.
Web site: http://rsync.samba.org/
Capabilities:
64-bit files, 64-bit inums, 32-bit timestamps, 64-bit long ints,
socketpairs, hardlinks, symlinks, IPv6, batchfiles, inplace,
append, ACLs, xattrs, iconv, no symtimes
rsync comes with ABSOLUTELY NO WARRANTY. This is free software, and you
are welcome to redistribute it under certain conditions. See the GNU
General Public Licence for details.
confxml.xml sersync2
<head version="2.5">
<host hostip="localhost" port="9090"></host>
<debug start="false"/>
<fileSystem xfs="false"/>
<filter start="false"> #请根据实际情况启用
<exclude expression="^((?!original\.).*)$"></exclude>
<exclude expression="image"></exclude>
<exclude expression="txt"></exclude>
<exclude expression="xml"></exclude>
<exclude expression="*"></exclude>
-->
</filter>
<inotify>
<delete start="false"/> #不监控文件或目录的删除
<createFolder start="true"/> #监控目录的创建
<modify start="true"/> #监控文件的修改
<createFile start="true"/>
<closeWrite start="true"/> #监控创建新文件
<moveFrom start="false"/>
<moveTo start="false"/>
<attrib start="false"/>
</inotify>
<sersync>
<localpath watch="/data/bookfm/doc/book"> #设置监控的目录
<remote ip="192.168.100.250" name="book"/>
<!--<remote ip="192.168.8.39" name="tongbu"/>-->
<!--<remote ip="192.168.8.40" name="tongbu"/>-->
</localpath>
<rsync>
<commonParams params="-au" --include='*original.*' --exclude='bin' --exclude='image' --exclude 'xml' --exclude='txt' --include='*/' --exclude='*'"/>
<auth start="true" users="bookbackup" passwordfile="/usr/local/GNU-Linux-x86/rsyncd.secrets"/>
<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-->
<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>
uid = root
#系统中存在的用户,这个用户要能对备份的路径有写入权限
gid = root
#系统中存在的用户组,用户组要能对备份的路径有写入权限
max connections = 100 #最大连接数
use chroot = no
log file = /var/rsync/rsync.log #指定同步日志
pid file = /var/rsync/rsyncd.pid #指定运行时PID文件
lock file = /var/rsync/rsyncd.lock
[book]
path = /backup/bookfm #指定备份的路径
read only=no #可写入
ignore errors = yes #忽略错误
secrets file =/etc/rsyncd/rsyncd.secrets
#指定rsync自身的密码文件(非系统用户)
auth users = bookbackup #指定这个共享名验证的用户名
hosts allow = 192.168.100.246/24 #只允许这个IP地址
RedHat Linux下利用sersync进行实时同步数据的更多相关文章
- Linux 下配置多机实时同步
没钱的时候,用此方案做网站内容的负载均衡.异地备份,经济实惠又方便(仅针对网站文件做实时同步,如果数据库,则考虑mysql的多主架构) 一.机器配置及机房IP A机,位于杭州,IP: 115.33.2 ...
- centos6.5下部署sersync+rsync --daemon同步数据
rsync --daemon端配置 [root@rsync-daemon etc]# /etc/init.d/iptables stop [root@rsync-daemon ~]# dos2unix ...
- Linux下Rsync+sersync实现数据实时同步
inotify 的同步备份机制有着缺点,于是看了sersync同步,弥补了rsync的缺点.以下转自:http://www.osyunwei.com/archives/7447.html 前言: 一. ...
- sersync/lsyncd实时同步
第一章 sersync/lsync实时同步 1.1 实时同步服务原理/概念 1)需要部署好rsync守护进程服务,实现数据传输 2)需要部署好inotify服务,实现目录中数据变化监控 3)将rsyn ...
- Linux下多任务间通信和同步-信号
Linux下多任务间通信和同步-信号 嵌入式开发交流群280352802,欢迎加入! 1.概述 信号是在软件层次上对中断机制的一种模拟,是一种异步通信方式.信号可以直接进行用户空间进程和内核进程之间的 ...
- Linux下利用script命令录制并回放终端会话
Linux下利用script命令录制并回放终端会话 核心命令 script 和 scriptreplay 录制屏幕 script -t 2>timescript typescript 命令解释: ...
- 解决redhat linux下IP地址可以ping通,域名无法ping通问题
解决redhat linux下IP地址可以ping通,域名无法ping通 在/etc/resolv.conf中添点东西 格式如下: nameserver xxx.xxx.xxx.xxx nameser ...
- 【java】 linux下利用nohup后台运行jar文件包程序
Linux 运行jar包命令如下: 方式一: java -jar XXX.jar 特点:当前ssh窗口被锁定,可按CTRL + C打断程序运行,或直接关闭窗口,程序退出 那如何让窗口不锁定? 方式二 ...
- linux下利用elk+redis 搭建日志分析平台教程
linux下利用elk+redis 搭建日志分析平台教程 http://www.alliedjeep.com/18084.htm elk 日志分析+redis数据库可以创建一个不错的日志分析平台了 ...
随机推荐
- hibernate缓存和提高效率
1.使用二级缓存,多把大批量的.短期多次的查询数据存到二级缓存中,避免和数据库的多次交互,增加负担.二级缓存加在那些增删改少的,查询多的类中.二级缓存的是对象,如果查出来的不是对象,不会放到缓存中去. ...
- 第四课 Gallery的使用
直接上代码 1.Layout--Main.axml <?xml version="1.0" encoding="utf-8"?> <Linea ...
- 计算系数(noip2011)
[问题描述]给定一个多项式(ax + by)^k,请求出多项式展开后(x^n)*(y^m)项的系数.[输入]输入文件名为 factor.in.共一行,包含 5 个整数,分别为a,b,k,n,m,每两个 ...
- 关于netbeans中的JComboBox(复选框)
以最近写的选课系统中添加课程项为例 1.往复选框中放入选项(根据数据库添加) (1)首先将 属性—>model中默认Item1234清空 (2)获得数据库中的数据并放入. SelectCour ...
- leetcode 239 Sliding Window Maximum
这题是典型的堆排序算法,只是比一般的堆算法多了删除的操作,有两件事需要做: 1 用一个hash表存储从输入数组索引到堆数组(用于实现堆的那个数组)所以的映射,以便在需要删除一个元素的时候能迅速定位到堆 ...
- java互斥方法
synchronized, lock/unlock, volatile类型变量, atom类, 同步集合, 新类库中的构件: CountDownLatch\CyclicBarric\Semaph ...
- BZOJ 1968 约数研究
其实打个表就会发现,这个玩意儿是积性的,然后很happy的搞了一下. 不,不是这样. 考虑每个约数对答案的贡献,不难发现:约数i的贡献为n/i. 加之即可. #include<iostream& ...
- apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName的解决
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ...
- ubuntu系统安装mongodb
安装mongodb sudo apt-get install mongodb ... ... 设置客户端连接 打开文件/etc/mongodb.conf 注意权限 修改 bind_ip=127.0. ...
- VIM_插件
VIM进阶:插件 通过一段时间的练习,你就可以非常熟练的使用VIM.即使是"裸奔",VIM已经足够强大,能够完成日常的绝大部分工作. 但VIM更加强大的是它的扩展机 ...