三、启动sersync服务
在FTP服务器(sersync+rsync)上开启sersync守护进程,使sersync在后台运行,开启实时同步。
[root@ftp GNU-Linux-x86]# ./sersync2 -d -r
set thesystem param
execute:echo50000000 > /proc/sys/fs/inotify/max_user_watches
execute:echo 327679> /proc/sys/fs/inotify/max_queued_events
parse thecommand param
option:-drun as a daemon
option:-rrsync all the local files to theremote servers before the sersync work
daemonthread num: 10
parse xmlconfig file
host ip :localhosthost port: 8008
daemonstart,sersync run behind the console
config xmlparse success
pleaseset /etc/rsyncd.conf max connections=0 Manually
sersyncworking thread 12= 1(primary thread) +1(fail retry thread) + 10(daemon sub threads)
Maxthreads numbers is: 22 = 12(Thread pool nums) + 10(Sub threads)
pleaseaccording your cpu ,use -n param to adjust the cpu rate
------------------------------------------
rsync thedirectory recursivly to the remote servers once
workingplease wait...
executecommand: cd /data/ftpdata && rsync -artuz -R --delete ./ 192.168.1.3::ftpdata>/dev/null 2>&1
run thesersync:
watchpath is: /data/ftpdata
*表明,sersync已经开启,可以在本地监控路径建立文件,查看远程是否同步成功!
[root@ftp GNU-Linux-x86]# ps -ef |grep rsync
root137710 18:48 ?00:00:00 ./sersync2 -d –r
最后需要把sersync命令加入到/etc/rc.local以开机自启动
[root@ftp GNU-Linux-x86]# echo "cd/usr/bin/GNU-Linux-x86&&./sersync2 -d -r" >> /etc/rc.local
四、测试验证
1、在ftp端/data/ftpdata目录上创建一个文件夹:
[root@ftp ftpdata]# mkdir zl
2、在backup端查看/data/ftpdata目录是否相同;
[root@backup ~]# ll /data/ftpdata/
五、备份与恢复
1、手动备份
192.168.1.2---------->192.168.1.3
[root@ftp~]# /usr/bin/rsync -vzrtopg --delete /data/ftpdata/ root@192.168.1.3::ftpdata
2、手动恢复
192.168.1.3---------->192.168.1.2
[root@ftp~]# /usr/bin/rsync -vzrtopg --delete root@192.168.1.3::ftpdata/data/ftpdata/
