sersync2 + rsync 实时同步文件

背景:测试环境静态文件经常会因为找不到,需要将线上的静态文件实时同步至测试环境;

测试环境地址:192.168.0.1

线上环境地质:192.168.0.2

由192.168.0.2地址向192.168.0.1实时同步文件

 

系统:centos7.6

一:目标节点安装rsync

1、在192.168.0.1安装rsync,yum install -y rsync

编辑/etc/rsyncd.conf配置文件

#/etc/rsyncd.conf
#静态资源图片文件线上同步至测试环境
uid = root
gid = root
use chroot = no
max connections = 200
timeout = 600
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
ignore errors
read only = false
list = yes

#允许同步节点
hosts allow = 192.168.0.2/32
host deny = 0.0.0.0/32
auth users = rsync_backup
secrets file = /etc/rsync.password
transfer logging = yes
#Module definitions

#定义模块名

[betastatic]
comment = beta-static
path = /static/public

备注:/etc/rsync.password如下,且chmod 600 /etc/rsync.password

启动命令:/usr/bin/rsync --daemon /etc/rsyncd.conf

 

二、源节点安装sersync2

下载sersync http://sersync.googlecode.com/files/sersync2.1_64bit_binary.tar.gz

解压文件至/opt/sersync/目录下

编辑/opt/sersync/confxml.xml,红色框内地址,模块名,同步用户,及密钥文件对应

备注:/etc/rsync.password1如下,chmod 600 /etc/rsync.password1 不需要用户,只需填写密码即可:

 

启动命令:/opt/sersync/sersync2 -r -d -o /opt/sersync/confxml.xml

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值