官网
参考文档
配置多机互信
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
网友评论