码迷,mamicode.com
首页 > 其他好文 > 详细

rsync+lsyncd实现实时同步

时间:2016-07-28 15:49:05      阅读:370      评论:0      收藏:0      [点我收藏+]

标签:

1.接收端安装rsync,修改/etc/rsyncd.conf配置文件,然后启动服务。

uid = root
gid = root
use chroot = no
max connection = 4
secrets file = /etc/rsyncd.secrets

[test] path
= /tmp/test auth users = bak read only = no

2.发送端安装rsync+lsyncd,修改/etc/lsyncd.conf配置文件,编辑密码文件(如果使用了密码同步),然后启动lsyncd服务。

settings = {
logfile = "/var/log/lsyncd.log",
statusFile = "/tmp/lsyncd.stat",
statusInterval = 1,  -- 同步时间间隔
}

sync {
default.rsync,
source="/data0/test",
target="bak@172.16.225.222::test",

rsync = {
        binary = "/usr/bin/rsync",
        archive = true,
        compress = true,
        verbose   = true,
        --delete =  true,
         _extra = {"--password-file=/etc/rsyncd.secrets"},
        },
}

 3.在发送端要同步的目录中添加、删除文件,查看接收端是否同步。

参考:http://openlinuxfly.blog.51cto.com/7120723/1679279

rsync+lsyncd实现实时同步

标签:

原文地址:http://www.cnblogs.com/wsl222000/p/5714751.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!