Operations 8 min read

How to Set Up Real-Time Data Sync with Sersync and Rsync on CentOS

This guide walks through configuring two CentOS 7.7 hosts for real-time data synchronization using Sersync and Rsync, covering environment preparation, service deployment, configuration file editing, manual testing, daemon startup, and automatic startup via rc.local.

Open Source Linux
Open Source Linux
Open Source Linux
How to Set Up Real-Time Data Sync with Sersync and Rsync on CentOS

1. Network Introduction

Two hosts are used for the experiment: qll251 as the Rsync server and Sersync server, and qll252 as the Rsync client. Both run CentOS 7.7, with the firewall disabled and SELinux set to disabled.

# cat /etc/redhat-release
CentOS Linux release 7.7.1908 (Core)
# systemctl stop firewalld && systemctl disable firewalld
# sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
# reboot
# getenforce
Disabled

2. Deployment

On the source host (qll251) deploy Sersync and Rsync services

Download the Sersync binary package:

# wget https://sersync.googlecode.com/files/sersync2.5.4_64bit_binary_stable_final.tar.gz

Extract the package and rename the directory:

# tar -zxvf sersync2.5.4_64bit_binary_stable_final.tar.gz
# mv GNU-Linux-x86/ sersync2.5.4

Edit /root/sersync2.5.4/confxml.xml to set the local backup path, remote IP (192.168.1.252), and authentication parameters:

<sersync>
  <localpath watch="/data">
    <remote ip="192.168.1.252" name="web"/>
  </localpath>
  <rsync>
    <commonParams params="-artuz"/>
    <auth start="true" users="rsync_user" passwordfile="/etc/rsync.mypass"/>
  </rsync>
</sersync>

Create the local backup directory and the Rsync password file:

# mkdir /data
# echo 123123 > /etc/rsync.mypass
# chmod 600 /etc/rsync.mypass

Install and start Rsync and Xinetd services:

# yum -y install rsync xinetd
# systemctl start rsyncd && systemctl enable rsyncd
# systemctl start xinetd && systemctl enable xinetd

On the client host (qll252) deploy the Rsync client

# yum -y install rsync

Edit /etc/rsyncd.conf with the following key settings:

uid = root
gid = root
address = 192.168.1.252
port = 873
hosts allow = 192.168.1.0/24
use chroot = yes
max connections = 5
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log
motd file = /etc/rsyncd.motd
[web]
  path = /mybak
  comment = used for mysql-data
  read only = false
  list = yes
  auth users = rsync_user
  secrets file = /etc/rsync.passwd

Create the destination directory and the password file for the client:

# mkdir /mybak
# echo "rsync_user:123123" > /etc/rsync.passwd
# chmod 600 /etc/rsync.passwd

Start the Rsync daemon with the custom configuration:

# rsync --daemon --config=/etc/rsyncd.conf
# echo "rsync --daemon --config=/etc/rsyncd.conf" >> /etc/rc.local

3. Start Sersync Daemon for Data Sync

Perform a manual sync to verify the environment:

# rsync -avz /data [email protected]::web --password-file=/etc/rsync.mypass

After confirming success, launch the Sersync daemon:

# /root/sersync2.5.4/sersync2 -d -r -o /root/sersync2.5.4/confxml.xml

Real‑time synchronization can be observed on both machines.

To enable automatic start after reboot, add the daemon command to /etc/rc.local and ensure both /etc/rc.local and /etc/rc.d/rc.local are executable:

# chmod +x /etc/rc.d/rc.local
# reboot
With these steps, the two hosts achieve continuous, real‑time data synchronization using Sersync and Rsync.
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 Administrationdata backupCentOSreal-time-syncsersync
Open Source Linux
Written by

Open Source Linux

Focused on sharing Linux/Unix content, covering fundamentals, system development, network programming, automation/operations, cloud computing, and related professional knowledge.

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.