加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

rsync + sersync 实现实时数据同步

发布时间:2020-12-14 02:08:19 所属栏目:Linux 来源:网络整理
导读:一、环境: 主机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 | gr

一、环境:

主机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
[backup]
path = /data/www
comment = backup
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?
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上验证:

删除后也会实时同步,验证成功。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读