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.
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.passwordCreate 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.passwordStart 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 873Test rsync manually from the master
rsync -avzPh --delete /data/ rsync://[email protected]/www --password-file=/etc/rsync.passwordInstall 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
└── logsConfigure 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.xmlTechnical 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.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
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.)
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
