Tag Archives: lsyncd

Lsyncd – basic setup

This is an example where you install Lsyncd on a CentOS master server and you sync the folder ‘data’ on a slave server with IP

First of all, your master server needs an SSH key setup AND the slave has to have it configured, to allow passwordless SSH connection

Here an article that tells you how to do it.

Configure Lsyncd



Add the service and enable it

On CentoS7 use this:



Once installed, you also need to be sure that Lsyncd logs are managed by Logrotate.

Create/update this file: /etc/logrotate.d/lsyncd


On CentOS7, you need to use sistemctl instead service command:

Test the logrotate config

You can test this using the command:


For more advanced Lsyncd configuration, check this article 🙂

Lsyncd – conf.d like setup on Ubuntu

On Ubuntu 14 (version 2.1.x)

Create configuration files

-> it should be /etc/lsyncd/lsyncd.conf.lua

Backup the original file and create a new conf file


Create the config file for 2 web nodes called w01 and w02.
These 2 nodes have the following IPs: w01 w02

Now let’s create the exclusions file. This will be the list of paths that won’t be sync’d.

NOTE! For exclusions, please remember to put the relative path, NOT the full path. In this case, it excludes www.mytestsite.com/ from /var/www/vhosts

Set up a logrotate conf file



Test Lsyncd


Error log – inotify issue

ERROR: Terminating since out of inotify watches//Consider increasing /proc/sys/fs/inotify/max_user_watches

Temporary fix:

Permanent fix (ALSO write sysctl.conf):

Lsync monitoring on Rackspace Cloud

You can test the above script by calling it directly to see if it is working and reporting stats:


Now, we need to create the alert itself.
[To get the token, you can use this]

NOTE: ENTITY_ID is the Monitoring ID, NOT the server ID!!

Once the alert has been created, you can add the alarm manually via the Control Panel:

Make sure to test and save the alert.