FreeBSD 14
Sponsored Link

Lsync : Synchronize Files / Directories2024/09/10

 

Install Lsync to configure live mirroring files and directories with Rsync + Lsync.

[1]

Configure rsyncd service on copy target Host, refer to here.
This example is based on the environment like follows as the link above, and additionally install lsyncd on copy source Host.

+----------------------+          |          +----------------------+
|    [dlp.srv.world]   |10.0.0.30 | 10.0.0.51|  [node01.srv.world]  |
|        lsyncd        +----------+----------+        rsyncd        |
|     /home/work/*     |   ------------->    |     /home/backup/*   |
+----------------------+      live copy      +----------------------+

[2] Install Lsync on copy source Host.
root@dlp:~ #
pkg install -y lsyncd
root@dlp:~ #
vi /usr/local/etc/lsyncd.conf
settings {
  logfile    = "/var/log/lsyncd.log",
  statusFile = "/var/log/lsyncd.status",
  statusInterval = 1,
  maxProcesses = 2,
  insist = 1,
}

sync{
  default.rsync,
  delay = 0,
  # specify copy source directory
  source="/home/work/",
  # specify copy target Hostname or IP address and target name: (set in rsyncd.conf)
  target="node01.srv.world::backup",
  # specify exclude file list
  excludeFrom="/usr/local/etc/rsync/exclude.lst",
  rsync = {
    archive  = true,
    compress = true
  },
  delete = true
}

root@dlp:~ #
service lsyncd enable

lsyncd enabled in /etc/rc.conf
root@dlp:~ #
service lsyncd start

Starting lsyncd.
[3]
That's OK.
Verify settings to create test files or directories on copy source Host and they are copied lively on copy target Host.

Matched Content