Synchronize local directories with a remote machine running rsyncd.
Version: 1.25Lsyncd uses rsync to synchronize local directories with a remote machine running rsyncd. Lsyncd watches multiple directories trees through inotify. The first step after adding the watches is to, rsync all directories with the remote host, and then sync single file buy collecting the inotify events.
Operating System: Linux
So lsyncd is a light-weight live mirror solution that should be easy to install and use while blending well with your system. See lsyncd –help for detailed command line options.
When to use
Lsyncd is designed to synchronize a local directory tree with low profile of expected changes to a remote mirror. On the receivers side rsyncd can be configured to also change the uid/gid of the file. Lsyncd is especially useful to sync data from a secure area to a not-so-secure area (e.g. as a one way connection to allow employees to publish their files to a public accessible web server).
When not to use:
File with active file handles (e.g. database files)
Directories where many changes occur (like mail or news servers)
In these cases e.g. DRBD (see http://www.linux-ha.org/DRBD) might be better for you.
Lsyncd vs. DRBD:
DRBD operates on block device level. This makes it useful for synchronizing systems that are under heavy load. Lsyncd on the other hand
does not require you to change block devices and/or mount points.
allows you to change uid/gid of the transferred files.
separates the receiver through the one-way nature of rsync.
However when using lsyncd a file change can possibly result in a full file transfer (at least for binary files) and is therefore unsuitable for databases. Also a directory rename will result in transferring the whole directory.
Lsyncd vs. incron:
Incron does not (yet) support recursive directory watching making it unsuitable for described needs (http://inotify.aiken.cz/?section=incron&page=about〈=en). In fact a different approach would have been to extent incron. However, we decided to stick to the NIH principle (Not Invented Here) :-), because extending the C++ solution seemed to tedious.
Lsyncd vs. FUSE:
This is another interesting idea is to write a daemon that provides a shadow file system through fuse. When accessing a file the data is synced to local file as well as the remote file. Whit this approach inotify could be replaced. BindFS (see http://www.cs.helsinki.fi/u/partel/bindfs/) does this for local mirroring. We discarded this idea because it would affect performance of normal operations in a negative way.
Lsyncd vs. cron:
If you find a solution using cron to call rsync over the whole directory tree periodically after every 'X' hours/minutes/seconds more satisfying than lsyncd, please go for it *sulking*. We don't like it!