码迷,mamicode.com
首页 > 系统相关 > 详细

【Linux】文件远程实时同步-- Lsyncd

时间:2020-12-07 12:37:12      阅读:11      评论:0      收藏:0      [点我收藏+]

标签:write   vim   esc   --   rom   soc   var   chmod   mon   

rsync服务端(wallet01)
[root@wallet01 ~]# yum install -y xinetd
[root@wallet01 ~]# yum install -y rsync

[root@wallet01 ~]# vim /etc/xinetd.d/rsync
# default: off
# description: The rsync server is a good addition to an ftp server, as it #       allows crc checksumming etc.
service rsync
{
        disable = no
        flags           = IPv6
        socket_type     = stream
        wait            = no
        user            = root
        server          = /usr/bin/rsync
        server_args     = --daemon
        log_on_failure  += USERID
}

[root@wallet01 ~]# vim /etc/rsyncd.conf 
uid = root
gid = root
use chroot = no
max connections = 1000
transfer logging = true
log format = "%o %h [%a] %m (%u) %f %l"
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
secrets file = /etc/rsyncd.pwd
fake super = yes

[oracle]
path = /home/oracle/backup
auth users = oracle
uid = oracle
gid = oinstall
read only = no

[root@wallet01 ~]# vim /etc/rsyncd.pwd
oracle:abcd.1234
[root@wallet01 ~]# chmod 600 /etc/rsyncd.pwd

[root@wallet01 ~]# service xinetd start
Starting xinetd:                                           [  OK  ]
rsync客户端(wallet02)
[root@wallet02 ~]# yum install -y lua lua-devel
[root@wallet02 ~]# yum install -y rsync
[root@wallet02 ~]# yum install -y lsyncd

[root@wallet02 ~]# vim /etc/lsyncd.conf
settings {
    logfile      ="/var/log/lsyncd/lsyncd.log",
    statusFile   ="/var/log/lsyncd/lsyncd.status",
    inotifyMode  = "CloseWrite",
    maxProcesses = 8,
    -- nodaemon =true,
    }
sync {
    default.rsync,
    source    = " /home/oracle/backup",
    target    = "tomcat@192.168.1.201::oracle",
    delete    = "false",
    -- excludeFrom = "/etc/rsyncd.d/rsync_exclude.lst",
    rsync     = {
        binary    = "/usr/bin/rsync",
        archive   = true,
        compress  = true,
        verbose   = true,
        password_file = "/etc/rsyncd.pwd"
        _extra    = {"--bwlimit=200"}
        }
    }
    
[root@wallet02 ~]# vim /etc/rsyncd.pwd
abcd.1234
[root@wallet02 ~]# chmod 600 /etc/rsyncd.pwd  

[root@wallet02 ~]# /etc/init.d/lsyncd start
Starting lsyncd:                                           [  OK  ]
[root@wallet02 ~]# /etc/init.d/lsyncd status
lsyncd (pid  3282) is running...

 

【Linux】文件远程实时同步-- Lsyncd

标签:write   vim   esc   --   rom   soc   var   chmod   mon   

原文地址:https://www.cnblogs.com/dbamonkey/p/14074450.html

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