lsyncd project address: https://github.com/axkibe/lsyncd
Environment Description:
192.168.56.101 Sync source 192.168.56.102 Sync target Operating system centos 7
Install lsyncd on the source host
Install epel-release before installing lsyncd [[email protected] ~]# yum install -y lsyncd [[email protected] ~]# cat /etc/lsyncd.conf ---- -- User configuration file for lsyncd. -- -- Simple example for default rsync, but executing moves through on the target. -- -- For more examples, see /usr/share/doc/lsyncd*/examples/ -- settings { logfile = "/var/log/lsyncd.log", statusFile = "/var/log/lsyncd.status", } sync { default.rsyncssh, source = "/data/web/web1", host = "[email protected]", targetdir = "/data/backup/web/web1", delay = 15, rsync = { archive = true, compress = true, verbose = true, rsh = "ssh -o StrictHostKeyChecking=no -i /root/.ssh/backup_rsa", } }