Rhel6-sersync配置文档
系统环境: rhel6 x86_64 iptables and selinux disabled
主服务器: 192.168.122.160 server60.example.com
目标服务器: 192.168.122.154 server54.example.com
相关网址: http://code.google.com/p/sersync/
所需的包:sersync2.5.4_64bit_binary_stable_final.tar.gz
1.配置目标服务器
[root@server54
~]# yum install rsync -y
[root@server54
~]# vim /etc/rsyncd.conf
uid=root
gid=root
max
connections=36000
use
chroot=no
log
file=/var/log/rsyncd.log
pid
file=/var/run/rsyncd.pid
lock
file=/var/run/rsyncd.lock
[tongbu1]
path=/opt/tongbu1
comment
= test files
ignore
errors = yes
read
only = no
hosts
allow = 192.168.122.160
hosts
deny = *
[tongbu2]
path=/opt/tongbu2
comment
= test files
ignore
errors = yes
read
only = no
hosts
allow = 192.168.122.160
hosts
deny = *
只允许主服务器server60访问,同步模块名为[tongbu1]
[tongbu2] ,/opt/tongbu1
/opt/tongbu2 为文件同步目录
[root@server54
~]# mkdir /opt/tongbu1
[root@server54
~]# mkdir /opt/tongbu2
[root@server54
~]# rsync –daemon 后台运行rsync
使用xinetd管理rsync服务
[root@server54
~]# yum install xinetd -y
[root@server54
~]# chkconfig rsync on
[root@server54
~]# /etc/init.d/xinetd restart
2.配置主服务器
[root@server60
~]# yum install rsync -y
[root@server60
kernel]# tar zxf sersync2.5.4_64bit_binary_stable_final.tar.gz
[root@server60 kernel]# cd GNU-Linux-x86/
[root@server60
GNU-Linux-x86]# vim confxml.xml
...
<sersync>
<localpath
watch="/opt/tongbu1">
(本地同步目录)
<remote
ip="192.168.122.154"
name="tongbu1"/>
(目标服务器列表和同步模块名)
</localpath>
...
[root@server60
GNU-Linux-x86]# cp confxml.xml confxml1.xml
[root@server60
GNU-Linux-x86]# vim confxml1.xml
...
<sersync>
<localpath
watch="/opt/tongbu2">
(本地同步目录)
<remote
ip="192.168.122.154"
name="tongbu2"/>
(目标服务器列表和同步模块名)
</localpath>
...
[root@server60
~]# mkdir /opt/tongbu1
[root@server60
~]# mkdir /opt/tongbu2
[root@server60
~]# cd kernel/GNU-Linux-x86/
[root@server60
GNU-Linux-x86]# ./sersync2 -o confxml.xml -r -d
[root@server60
GNU-Linux-x86]# ./sersync2 -o confxml1.xml -r -d
可查看到如上进程说明启动成功.
测试:分别在server60的/opt/tongbu1和/opt/tongbu2中创建文件或目录,然后查看是否将数据同步到server54的/opt/tongbu1和/opt/tongbu2中
3.运行sersync与sersync启动参数
sersync会对目录进行监控,将变化的目录或文件同步到远程服务器。sersync是递归监控的,如
果有多级目录,都会同步到远程服务器。常用启动方式如下:
在主服务器上开启sersync守护进程,使sersync在后台运行,开启实时同步。
./sersync2
-d
set
the system param
execute:echo
50000000 > /proc/sys/fs/inotify/max_user_watches
execute:echo
327679 > /proc/sys/fs/inotify/max_queued_events
parse
the command param
option:
-d run as a daemon
daemon
thread num: 10
parse
xml config file
host
ip : localhost host port: 8008
daemon
start,sersync
run behind the console
config
xml parse success
please
set /etc/rsyncd.conf max connections=0 Manually
sersync
working thread 12 = 1(primary thread) + 1(fail retry thread) +
10(daemon sub threads)
Max
threads numbers is: 22 = 12(Thread pool nums) + 10(Sub threads)
please
according your cpu ,use
-n param to adjust the cpu rate
run
the sersync:
watch
path is: /opt/tongbu1
在开启实时监控的之前对主服务器目录与远程目标机目录进行一次整体同步
./sersync2
-r
如果需要将sersync运行前,已经存在的所有文件或目录全部同步到远程,要以-r参数运行
sersync,将本地与远程整体同步一次。
如果设置了过滤器,即在xml文件中,filter为true,则暂时不能使用-r参数进行整体同步。-r参数将
会无效
指定配置文件
./sersync2
-o XXXX.xml
对于sersync使用可执行文件目录下的默认配置文件confxml.xml,如果需要使用另一个配置文
件,可以使用-o参数指定其它配置文件。
指定默认的线程池的线程总数
./sersync2
-n num
例如
./sersync2 -n 5
则指定线程总数为5,如果不指定,默认启动线程池数量是10,如果cpu使用
过高,可以通过这个参数调低,如果机器配置较高,可以用-n调高线程总数。
不进行同步,只运行插件
./sersync2
-m pluginName
例如./sersync2
-m command,则在监控到文件事件后,不对远程目标服务器进行同步,而是直接
运行command插件。
多个参数可以配合使用
./sersync2
-n 8 -o abc.xml -r -d
个,指定abc.xml作为配置文件,在实时监控前作一次整体同步,
以守护进程方式在后台运行。
通常情况下,对本地到远程整体同步一遍后,在后台运行实时同步。
./sersync2
-r -d
Rhel6-sersync配置文档的更多相关文章
- MYSQL服务器my.cnf配置文档详解
MYSQL服务器my.cnf配置文档详解 硬件:内存16G [client] port = 3306 socket = /data/3306/mysql.sock [mysql] no-auto-re ...
- 转!!Java代码规范、格式化和checkstyle检查配置文档
为便于规范各位开发人员代码.提高代码质量,研发中心需要启动代码评审机制.为了加快代码评审的速度,减少不必要的时间,可以加入一些代码评审的静态检查工具,另外需要为研发中心配置统一的编码模板和代码格式化模 ...
- Hibernate配置文档详解
Hibernate配置文档有框架总部署文档hibernate.cfg.xml 和映射类的配置文档 ***.hbm.xml hibernate.cfg.xml(文件位置直接放在src源文件夹即可) (在 ...
- Java代码规范、格式化和checkstyle检查配置文档
http://www.blogjava.net/amigoxie/archive/2014/05/31/414287.html 文件下载: http://files.cnblogs.com/files ...
- Spring Hibernate4 整合配置文档
1 applicationContext.xml配置文档 <?xml version="1.0" encoding="UTF-8"?><bea ...
- Kerberos主从配置文档
Kerberos主从配置文档 1. Kerberos主从同步机制 在Master上通过以下命令同步数据: kdb5_util dump /var/kerberos/krb5kdc/slave_db ...
- python常用模块-配置文档模块(configparser)
python常用模块-配置文档模块(configparser) 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. ConfigParser模块用于生成和修改常见配置文档,当前模块的名称 ...
- azkaban编译安装配置文档
azkaban编译安装配置文档 参考官方文档: http://azkaban.github.io/azkaban/docs/latest/ azkaban的配置文件说明:http://azkaban. ...
- Python学习 :常用模块(四)----- 配置文档
常用模块(四) 八.configparser 模块 官方介绍:A configuration file consists of sections, lead by a "[section]& ...
- configparser模块——配置文档
configparser模块用于生成和修改常见配置文档. 预制配置文件:conf.ini [DEFAULT] ServerAliveInterval = 45 Compression = yes Co ...
随机推荐
- Android PullToRefresh (ListView GridView 下拉刷新) 使用详解
转载请标明出处:http://blog.csdn.net/lmj623565791/article/details/38238749,本文出自:[张鸿洋的博客] 群里一哥们今天聊天偶然提到这个git ...
- [python]WindowsError的错误代码详解
转自:http://www.aichengxu.com/view/46906 WindowsError的错误代码详解 0操作成功完成. 1功能错误. 2系统找不到指定的文件. 3系统找不到指定的路径. ...
- Microsoft JScript提示‘DIRECT’未定义(2014-08-26记)
当启动Applet的时候,页面弹出:DIRECT’未定义可能的问题是:java控制面板的网络设置问题,可能使用了代理解决: 打开java控制面板--->网络设置-->直接连接-->确 ...
- [转] GitHub上README.md教程
点击阅读原文 最近对它的README.md文件颇为感兴趣.便写下这贴,帮助更多的还不会编写README文件的同学们. README文件后缀名为md.md是markdown的缩写,markdown是一种 ...
- App.config应用的说明
对访问数据库的链接字符串的封装(MS什么都在封装,弄的我们原来越方(弱)便(智)),好吧,你可以解释说可以方便的更改链接只更改配置,而不用动主程序------隔离(隔离--保护:搞过配电的应该不陌生吧 ...
- C#操作Dataset数据集与SQLite数据库
近日有需要写点C#程序,有用到Dataset数据集和SQLite数据库,由于我从来就不擅长记各种编程语言的语法,所以在查阅一堆资料后,留下以下内容备忘: 一.SQLite操作,直接贴代码,很简 ...
- noi 1944 吃糖果
题目链接:http://noi.openjudge.cn/ch0206/1944/ 根据第一天吃的个数递推,发现这个递推关系很像斐波那契数列. http://paste.ubuntu.com/2340 ...
- Uva 11090 在环中
题目链接:http://vjudge.net/contest/143318#problem/A 题意: 求平均权值最小的回路. 分析: 平均权值不可能超过最大边,二分查,然后,由于是平均权值,就可以转 ...
- LA 4287 等价性证明
题目链接:http://vjudge.net/contest/141990#overview 题意是告诉你有n个命题,m条递推关系,表示某个命题可以推出另外一个命题. 现在问你至少在增加多少个递推关系 ...
- 2016年12月21日 星期三 --出埃及记 Exodus 21:16
2016年12月21日 星期三 --出埃及记 Exodus 21:16 "Anyone who kidnaps another and either sells him or still h ...