大佬教程收集整理的这篇文章主要介绍了rsync + sersync 实现实时数据同步,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
一、环境:
主机1:youzhuan-bak centos 7.2
主机2:youzhuan-online centos 7.2
二、部署过程:
youzhuan-bak :
[[email protected] ~]# yum install rsync -y
[[email protected] ~]# rsync --daemon
[[email protected] ~]# netstat -an | grep 873
[[email protected] ~]# cat /etc/rsyncd.conf rsync配置文件修改
uid = nobody
gid = nobody
use chroot = yes
address = 0.0.0.0
port 873
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
hosts allow = 172.24.119.202
[@R_197_11442@kup]
path = /data/www
comment = @R_197_11442@kup
read only = false
auth users = liang
secrets file = /etc/rsyncd.pwd
[[email protected] ~]# cat /etc/rsyncd.pwd 增加秘钥文件
liang:m2i3sc
[[email protected] ~]# chmod 600 /etc/rsyncd.pwd 权限必须为 600
[[email protected] ~]# ll /etc/rsyncd.pwd
-rw------- 1 root root 13 Mar 29 21:18 /etc/rsyncd.pwd
youzhuan-online : 配置 sersync
下载安装包: sersync2.5.4_64biT_Binary_stable_final.tar.gz
[[email protected] local]# tar -xf sersync2.5.4_64biT_Binary_stable_final.tar.gz
[[email protected] localt]# mv GNU-Linux-x86/ sersync
[[email protected] local]# cd sersync
[[email protected] sersync]# cp confxml.xml confxml.xml.bak
[[email protected] sersync]# vim confxml.xml
[[email protected] sersync]# cat /etc/liang.passwd @H_730_35@m2i3sc
[[email protected] sersync]# chmod 600 /etc/liang.passwd
[[email protected] sersync]# ll /etc/liang.passwd
-rw------- 1 root root 7 Mar 29 21:19 /etc/liang.passwd
[[email protected] sersync]# /usr/local/sersync/sersync2 -d -r -o /usr/local/sersync/confxml.xml
测试 :
[[email protected] sersync]# cd /data/www/
[[email protected] www]# mkdir 999
在 youzhuan-bak上验证:
删除后也会实时同步,验证成功。
以上是大佬教程为你收集整理的rsync + sersync 实现实时数据同步全部内容,希望文章能够帮你解决rsync + sersync 实现实时数据同步所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。