a、配置 Sersync 环境变量
[[email protected] sersync]# echo ‘export PATH=$PATH:/usr/local/sersync/bin‘>>/etc/profile
[[email protected] sersync]# tail -1 /etc/profile export PATH=$PATH:/usr/local/sersync/bin [[email protected] sersync]# . /etc/profile [[email protected] sersync]# which sersync
启动的过程及结果:
注意:我们这里要启动的是多实例,即 confxml.xml 和 download_confxml.xml
[[email protected] ~]# ls /usr/local/sersync/conf/*
/usr/local/sersync/conf/confxml.xml
/usr/local/sersync/conf/confxml.xml.bak.2014-06-04
/usr/local/sersync/conf/download_confxml.xml
[[email protected] ~]# sersync -r -d -o /usr/local/sersync/conf/confxml.xml
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: -r rsync all the local files to the Remote Servers before the sersync work
option: -d run as a daemon
option: -o config xml name: /usr/local/sersync/conf/confxml.xml
daemon thread num: 10
parse xml config file
host ip : localhosthost port: 8008
daemon start,sersync run behind the console
use rsync password-file :
user isrsync_bak
passwordfile is /etc/rsync.password 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 thr eads)
Max threads numbers is: 32 = 12(Thread pool nums) + 20(Sub threads)
chmod: cannot access `/usr/local/logs/rsync_fail_log.sh‘: No such file or directory
------------------------------------------
rsync the directory recursivly to the Remote Servers once working please wait...
execute command: cd /data/web && rsync -aruz -R --delete ./ --timeout=100 rsync_bak
@172.16.100.1::web --password-file=/etc/rsync.password >/dev/null 2>&1
run the sersync:
watch path is: /data/web
[[email protected] ~]# sersync -r -d -o /usr/local/sersync/conf/download_confxml.xml
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: -r rsync all the local files to the Remote Servers before the sersync work
option: -d run as a daemon
option: -o config xml name: /usr/local/sersync/conf/download_confxml.xml
daemon thread num: 10
parse xml config file
host ip : localhosthost port: 8008
daemon start,sersync run behind the console
use rsync password-file :
user isrsync_bak
passwordfile is /etc/rsync.password config xml parse success
please set /etc/rsyncd.conf max connections=0 Manually
eads)
Max threads numbers is: 32 = 12(Thread pool nums) + 20(Sub threads)
please according your cpu ,use -n param to adjust the cpu rate
chmod: cannot access `/usr/local/logs/rsync_fail_log.sh‘: No such file or directory
------------------------------------------
rsync the directory recursivly to the Remote Servers once
working please wait...
execute command: cd /data/download && rsync -aruz -R --delete ./ --timeout=100 rsync
[email protected]::download --password-file=/etc/rsync.password >/dev/null 2>&1
run the sersync:
watch path is: /data/download
[[email protected] ~]# ps -ef |grep sersync
root 2114 1 0 01:56 ? 00:00:00 sersync -r -d -o /usr/local/sersync/conf/confxml.
xml
root 2223 1 0 02:03 ? 00:00:00 sersync -r -d -o /usr/local/sersync/conf/downloa
d_confxml.xml
root 2295 2244 0 02:08 pts/2 00:00:00 grep sersync
C、配置开机自启动
[[email protected] ~]# cp /etc/rc.local /etc/rc.local.bak._$(date +%F)
[[email protected] ~]# cat >>/etc/rc.local<< ‘EOF‘
> # sync data to 172.16.100.1,172.16.100.2
> sersync -d -o /usr/local/sersync/conf/confxml.xml
> sersync -d -o /usr/local/sersync/conf/download_confxml.xml
> EOF
总结以上是内存溢出为你收集整理的linux开启 Sersync 守护进程进行数据同步全部内容,希望文章能够帮你解决linux开启 Sersync 守护进程进行数据同步所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)