Sersync使用指南 sersy…
来源:互联网 发布:java 字符串替换 编辑:程序博客网 时间:2024/05/29 08:33
目的:
要把同步服务器中的目录/opt/tongbu1实时同步到三个同步目标主服务器中的/opt/tongbu1目录中。以做到文件的实时备份!
如上图所示,需要在同步主服务器上配置sersync,在同步目标服务器配置rsync,并在目标服务器开启rsync守候进程,这样在主服务器产生的文件,就会被sersync实时同步到多个目标服务器。在CentOS系统下默认已经安装了rsync,只需进行配置,并开启rsync守候进程即可。
配置同步目标服务器rsync
在多台目标服务器上配置如下(11、12、13都是同样的配置):
================================
vi/etc/rsyncd.conf
uid=root
gid=root
maxconnections=36000
usechroot=no
logfile=/var/log/rsyncd.log
pidfile=/var/run/rsyncd.pid
lockfile=/var/run/rsyncd.lock
[tongbu1]
path=/opt/tongbu1
comment
ignoreerrors = yes
read only =no
hosts allow=
hosts deny= *
================================
#rsync --daemon
1.在主服务器上开启sersync守护进程,使sersync在后台运行,开启实时同步。
./sersync -d
过程如下:
=================================
[root@localhost GNU-Linux-x86]#ls
confxml.xml
[root@localhost GNU-Linux-x86]# ./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
daemon thread num: 10
parse xml config file
host ip :localhost
config xml parse success
please set /etc/rsyncd.conf max connections=0 Manually
sersync working thread 12
please according your cpu ,use -n param to adjust the cpurate
run the sersync:
watch path is: /opt/tongbu
表明,sersync已经开启,可以在本地监控路径下建立文件,查看远程是否同步成功。
2.在开启实时监控的之前对主服务器目录与远程目标机目录进行一次整体同步
如果设置了过滤器,即在xml文件中,filter为true,则暂时不能使用-r参数进行整体同步。-r参数将会无效。
一、运行
二、附录:启动参数举例
#通常情况下使用这种方式,对本地到远程整体同步一遍后,在后台运行实时同步。
#在主服务器上开启sersync守护进程,使sersync在后台运行,开启实时同步。
#在开启实时监控的之前对主服务器目录与远程目标机目录进行一次整体同步
#指定默认的线程池的线程总数,如果不指定,默认启动线程池数量是10(适用于四核服务器)
#如果cpu使用过高,可以通过这个参数调低,如果机器配置较高,可以用-n跳高线程总数。
例如./sersync -m command,则在监控到文件事件后,不对远程目标服务器进行同步,而是直接运行command插件。
./sersync -n 8 -o abc.xml -r-d
表示,设置线程池工作线程为8个,指定abc.xml作为配置文件,在实时监控前作一次整体同步,以守护进程方式在后台运行。
echo50000000 > /proc/sys/fs/inotify/max_user_watches
- Sersync使用指南 sersy…
- Sersync使用指南 sersy…
- Sersync使用指南 sersy…
- Xcode 4 使用指南系列1-下…
- xcode 4 使用指南系列2-Int…
- 集线器 交换机 路由器 网桥 …
- 使用BBED修改SCN …
- prototype.js 使用指南(转载)
- Hive安装 …
- android o…
- android …
- [转] 彼尔…
- “constructors not allowed …
- 关于alter system switch lo…
- MPMoviePlayerController …
- HDU 1075 What Are You Talking …
- HDOJ 1017 A Mathematical Cur…
- HDOJ 1039 Easier Done Than Sa…
- 定时器加回调监听
- php中的单例模式和工厂模式
- 2015年07月16日
- linux下去掉文件中^M的方法
- sersync2.5+rsync实现数据同…
- Sersync使用指南 sersy…
- Sersync使用指南 sersy…
- 为什么V8引擎这么快?
- Sersync使用指南 sersy…
- /etc/sysctl.conf参数解释
- 设置Linux内核参数 /et…
- WEB服务器TCP:time wait&nbsp…
- Spring定时任务的几种实现
- PHP中数字检测is_numeric与ctype_d…