美文网首页
lsyncd —— 多机器实时同步文件神器

lsyncd —— 多机器实时同步文件神器

作者: 王小杰at2019 | 来源:发表于2020-09-21 18:29 被阅读0次

    官网

    https://axkibe.github.io/lsyncd/

    参考文档

    https://shockerli.net/post/linux-tool-lsyncd/

    配置多机互信

    ssh-keygen -t rsa
    ssh-copy-id -i  .ssh/id_rsa.pub root@192.168.31.x
    

    安装

    yum -y install lsyncd
    

    配置文件

    ssh 认证同步多台主机文件 /etc/lsyncd.conf

    settings {
        nodaemon = false,
        logfile = "/var/log/lsyncd.log",
        statusFile = "/var/log/lsyncd.status",
        inotifyMode = "CloseWrite",
        maxProcesses = 8
    }
    
    -- 可以有多个sync,各自的source,各自的target,各自的模式,互不影响。
    sync {
        default.rsyncssh,
        source    = "/home/tomcat/logs/",
        host    = "www@192.168.x.x",
        targetdir   = "/home/www/logs/",
        delay = 0,
        rsync = {
            binary = "/usr/bin/rsync",
            archive = true,
            compress = true,
            verbose = true
        },
    }
    

    开机启动

    centos6

    /etc/init.d/lsyncd start
    chkconfig lsyncd on
    

    centos7

    systemctl start lsyncd
    systemctl enable lsyncd
    systemctl status lsyncds
    

    相关文章

      网友评论

          本文标题:lsyncd —— 多机器实时同步文件神器

          本文链接:https://www.haomeiwen.com/subject/fdqbyktx.html