Operations 8 min read

How to Set Up Real‑Time File Sync with sersync and rsync on Linux

This guide explains what sersync is, its main features and use cases, and provides step‑by‑step instructions—including server preparation, rsync daemon setup, configuration files, password handling, and command examples—to deploy a real‑time file synchronization service on Linux.

Liangxu Linux
Liangxu Linux
Liangxu Linux
How to Set Up Real‑Time File Sync with sersync and rsync on Linux

What is sersync?

sersync is an open‑source real‑time file synchronization tool built on the rsync protocol. It monitors filesystem events and instantly pushes changed files to remote servers, delegating the actual data transfer to rsync.

Key Features

Real‑time monitoring of file modifications, additions, and deletions.

Event‑driven synchronization: changes automatically trigger sync operations.

Highly configurable: precise selection of files or directories to sync and detailed control of rsync options.

Leverages rsync’s delta‑transfer and compression for efficient bandwidth usage.

Typical Use Cases

Live website data backup – automatically replicate website changes to a backup server.

Cluster data consistency – keep files synchronized across multiple servers.

Real‑time file sharing between machines or locations.

Installation and Configuration

Prepare the environment Master server: 192.168.1.20 Slave1 (rsync): 192.168.1.21 Slave2 (rsync): 192.168.1.22

Install rsync on all servers yum install -y rsync The master runs rsync as a regular command; slaves run it as a daemon.

Configure rsync daemon on each slave

[root@k8svip ~]# cat /etc/rsyncd.conf
uid = root
gid = root
use chroot = no
max connections = 500
timeout = 600
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log

[ www ]
# Identifier used by sersync
path = /data/www
ignore errors
read only = false
write only = true
list = false
hosts allow = 192.168.1.20
auth users = rsync_backup
secrets file = /etc/rsync.password

Create the shared directory: [root@k8svip ~]# mkdir /data/www Set up password files

# On each slave
echo 'rsync_backup:123456' > /etc/rsync.password
chmod 600 /etc/rsync.password

# On the master (client password file)
echo '123456' > /etc/rsync.password

Start rsync daemon on slaves and enable at boot

[root@k8svip ~]# rsync --daemon
# Add to /etc/rc.local
/usr/bin/rsync --daemon
# Verify listening on port 873
netstat -antpu | grep 873

Test rsync manually from the master

rsync -avzPh --delete /data/ rsync://[email protected]/www --password-file=/etc/rsync.password

Install sersync on the master

wget https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/sersync/sersync2.5.4_64bit_binary_stable_final.tar.gz
tar -zxvf sersync2.5.4_64bit_binary_stable_final.tar.gz
mv GNU-Linux-x86 /usr/local/sersync
cd /usr/local/sersync && mkdir conf bin logs
mv sersync2 bin/ && mv confxml.xml conf/

Directory layout after extraction:

.
├── bin
│   └── sersync
├── conf
│   ├── confxml.xml
│   └── confxml.xml_20240510
└── logs

Configure sersync Place the prepared confxml.xml (shown in the image below) into /usr/local/sersync/conf/ .

Start the sersync service

sersync -r -d -o /usr/local/sersync/conf/confxml.xml

Technical Comparison

Using inotify-tools alone provides event‑based monitoring, but it does not record which specific files changed. Consequently, each rsync run must scan the entire directory tree to determine updates, which is inefficient for large datasets.

sersync extends inotify-tools by maintaining a precise list of changed files. When sersync triggers rsync, the latter receives this list and transfers only the affected files, avoiding a full directory scan and dramatically improving synchronization speed and resource usage.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

LinuxSystem Administrationrsyncsersyncreal-time file sync
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.