lsyncd - synchronize daemon
Page content
What’s lsyncd
My understanding is, it’s kind of rsync
daemon.
Install
On Ubuntu
Install on source servers (no need to install on destination servers).
apt update
apt install lsyncd
Set kernel parameter fs.inotify.max_user_watches
.
/etc/sysctl.conf
# for lsyncd
fs.inotify.max_user_watches = 8192000
Before running
We should configure firewall so that the source server can SSH to destination servers.
Here is my ssh snippets.
Use (sync)
Configuration
Here is the configuration example.
mkdir /etc/lsyncd
vim /etc/lsyncd/lsyncd.conf.lua
settings{
logfile = "/var/log/lsyncd.log",
statusFile = "/tmp/lsyncd.stat",
statusInterval = 1,
delay=0,
}
fundation = {
default.rsync,
source="/path/to/source/sync/dir",
target="user@dest.com:/path/to/dest/dir",
delay=0,
rsync = {
owner = true,
group = true,
archive = true,
links = true,
update = true,
verbose = false,
bwlimit = 30000,
rsh = "/usr/bin/ssh -i /home/atlex00/.ssh/id_rsa -l atlex00 -o StrictHostKeyChecking=no"
}
}
sync{ fundation, target="user@dest.com:/path/to/dest/dir" }
Start sync
systemctl restart lsyncd