官網(wǎng)
參考文檔
配置多機(jī)互信
ssh-keygen -t rsa
ssh-copy-id -i .ssh/id_rsa.pub root@192.168.31.x
安裝
yum -y install lsyncd
配置文件
ssh 認(rèn)證同步多臺主機(jī)文件 /etc/lsyncd.conf
settings {
nodaemon = false,
logfile = "/var/log/lsyncd.log",
statusFile = "/var/log/lsyncd.status",
inotifyMode = "CloseWrite",
maxProcesses = 8
}
-- 可以有多個(gè)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
},
}
開機(jī)啟動(dòng)
centos6
/etc/init.d/lsyncd start
chkconfig lsyncd on
centos7
systemctl start lsyncd
systemctl enable lsyncd
systemctl status lsyncds