发布于 2016-02-06 10:14:53 | 138 次阅读 | 评论: 0 | 来源: 网友投递
rsync 数据同步
rsync是类unix系统下的数据镜像备份工具,从软件的命名上就可以看出来了——remote sync。
如图所示,需要在同步主服务器上配置sersync,在同步目标服务器配置rsync,并在目标服务器开启rsync守候进程,这样在主服务器产生的文 件,就会被sersync实时同步到多个目标服务器。在centos系统下默认已经安装了rsync,只需进行配置,并开启rsync守候进程即可。
在多台目标服务器上配置如下:
vi /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 = xoyo video files
ignore errors = yes
read only = no
hosts allow = 192.168.0.100/24
hosts deny = *
./sersync -d
[root@localhost GNU-Linux-x86]# ls
confxml.xml sersync2
[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 host port: 8008
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)
please according your cpu ,use -n param to adjust the cpu rate
run the sersync:
watch path is: /opt/tongbu
./sersync -r
./sersync --help
./sersync -o XXXX.xml
./sersync -n num
./sersync -m pluginName
./sersync -n 8 -o abc.xml -r -d
./sersync -d