Implementing Real-Time Data Synchronization with Sersync and Inotify

Real-Time Synchronization Architecture

Real-time synchronization requires three core components: rsync daemon for data transfer, inotify for monitoring directory changes, and sersync to integrate both services.

Core Components:

  • Directory Monitoring: inotify tracks file system events
  • Data Transfer: rsync handles efficient file synchronization
  • Integration Layer: sersync bridges monitoring and transfer operations

Deployment Methodology

  1. Configure rsync daemon service
  2. Install inotify monitoring tools
  3. Deploy sersync synchronization software

Inotify Service Implementation

Install the monitoring package:

yum install -y inotify-tools

Key Utilities:

  • /usr/bin/inotifywait - Monitors directory changes
  • /usr/bin/inotifywatch - Statistics for monitored events

View installed files:

rpm -ql inotify-tools

Command Syntax:

inotifywait [options] target_directory

Common Parameters:

  • -m - Continuous monitoring mode
  • -r - Recursive directory monitoring
  • -q - Quiet operation with minimal output
  • --format - Custom output formatting
  • --timefmt - Time format specification
  • -e - Specific events to monitor
  • -d - Daemon mode operation

Enterprise Monitoring Command:

inotifywait -mrq --timefmt "%F" --format "%T %w %f Event:%e" /data -e create,delete,move

Sersync Deployment Process

Step 1: Download Software Obtain sersync from the official repository:

git clone https://github.com/wsgzao/sersync

Step 2: Extract and Prepare

unzip sersync_installdir_64bit.zip
tree sersync_installdir_64bit

Step 3: Install to System Directory

mv sersync_installdir_64bit/sersync/ /usr/local/

Step 4: Configure Synchronization Rules Edit /usr/local/sersync/conf/confxml.xml:

Exclusion Filters:

<filter start="false">
    <exclude expression="(.*)\.svn"></exclude>
    <exclude expression="(.*)\.gz"></exclude>
    <exclude expression="^info/*"></exclude>
    <exclude expression="^static/*"></exclude>
</filter>

Event Monitoring Configuration:

<inotify>
    <delete start="true"/>
    <createFolder start="true"/>
    <createFile start="false"/>
    <closeWrite start="true"/>
    <moveFrom start="true"/>
    <moveTo start="true"/>
    <attrib start="false"/>
    <modify start="false"/>
</inotify>

Synchronization Targets:

<localpath watch="/opt/sync_data">
    <remote ip="192.168.1.100" name="backup_module"/>
</localpath>
<rsync>
    <commonParams params="-artuz"/>
    <auth start="false" users="syncuser" passwordfile="/etc/rsync.pass"/>
</rsync>

Service Management

Runtime Parameters:

  • -d - Daemon mode execution
  • -r - Initial synchronization before monitoring
  • -o - Configuraton file specification

Add to system PATH:

export PATH="$PATH:/usr/local/sersync/bin"

Start Synchronization Service:

sersync -dro /usr/local/sersync/conf/confxml.xml

Stop Service: Install process management utilities:

yum install -y psmisc
killall sersync

Automatic Startup Configuration: Add to /etc/rc.local:

/usr/local/sersync/bin/sersync -dro /usr/local/sersync/conf/confxml.xml

Tags: Linux sersync inotify rsync real-time-synchronization

Posted on Tue, 15 Sep 2026 16:27:44 +0000 by NottaGuru