Chinaunix首页 | 论坛 | 博客
  • 博客访问: 376827
  • 博文数量: 80
  • 博客积分: 1750
  • 博客等级: 上尉
  • 技术积分: 1380
  • 用 户 组: 普通用户
  • 注册时间: 2011-11-13 11:35
文章分类
文章存档

2014年(3)

2013年(1)

2012年(54)

2011年(22)

分类: 服务器与存储

2011-11-14 17:17:00

Sersync 单向同步
 
系统环境:RHEL6.0_x86_64    selinux and iptables disabled
主服务器:192.168.0.4
目标服务器:192.168.0.8
软件下载:
原理图:

 
man rsyncd.conf 查看EXAMPLES示例
在目标服务器上配置同步目标服务器rsync,rsyncd.conf手动创建
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    #可选
[rsync]             //模块名
path=/test         //文件同步目录
comment = test files
ignore errors = yes   (可选)
read only = no
hosts allow = 192.168.0.4 //指定主服务器的IP (可选)
hosts deny =*    (可选)

rsync --daemon    //启动后台运行rsync
******************************************
主服务器上配置sersync
tar -zxf sersync2.5_64bit_binary_stable_final.tar.gz
cd GNU-Linux-x86/
vim confxml.xml


         "/testdir"> //本地同步文件目录
             192.168.0.8" name="rsync"/> //目标服务器IP及同步模块名
            
            
        
在主服务器上开启sersync守护进程
使sersync在后台运行,开启事实同步
执行 ./sersync2 -d
[root@silence 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
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: /test
在开启实时监控之前,对主服务器目录与目标服务器目录进行一次整体同步
执行 ./sersync2 -r
也可直接使用./serync2 -r -d 直接实现实时同步



若在阅读的过程中发现了任何错误或你有什么建议,
欢迎mail到yungho@yeah.net
一起交流学习

 
阅读(1773) | 评论(0) | 转发(0) |
0

上一篇:PXE自动化安装部署

下一篇:tar打包压缩

给主人留下些什么吧!~~