Fading Coder

One Final Commit for the Last Sprint

Home > Tech > Content

Real-Time Data Synchronization Using rsync and sersync

Tech Apr 30 11
# Environment preparation on CentOS 7.7
$ 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

Deployment Steps

  • Configure sersync + rsync service on source machine
  1. Download sersync binary package:
$ wget https://sersync.googlecode.com/files/sersync2.5.4_64bit_binary_stable_final.tar.gz
  1. Extract downloaded archive:
$ tar -zxvf sersync2.5.4_64bit_binary_stable_final.tar.gz
GNU-Linux-x86/
GNU-Linux-x86/sersync2
GNU-Linux-x86/confxml.xml

$ mv GNU-Linux-x86/ sersync2.5.4
  1. Modify configuration file /root/sersync2.5.4/confxml.xml:
<?xml version="1.0" encoding="ISO-8859-1"?>
<head version="2.5">
    <hostid>localhost</hostid>
    <local base="/path/to/source/data/">
        <filter start="false">
            <exclude expression=".*\.tmp"/>
        </filter>
        <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>
    </local>
    <remote base="/path/to/destination/data/">
        <rsync>
            <commonParams>--archive --delete</commonParams>
            <auth start="false"/>
            <userDefinedPort start="false" port="874"/>
            <timeout start="false" time="100"/>
            <ssh start="false"/>
        </rsync>
        <staticBackup>
            <enabled start="false"/>
        </staticBackup>
    </remote>
</head>
  1. Launch synchronization process:
$ cd /root/sersync2.5.4
$ ./sersync2 -r -d -o confxml.xml

Related Articles

Understanding Strong and Weak References in Java

Strong References Strong reference are the most prevalent type of object referencing in Java. When an object has a strong reference pointing to it, the garbage collector will not reclaim its memory. F...

Comprehensive Guide to SSTI Explained with Payload Bypass Techniques

Introduction Server-Side Template Injection (SSTI) is a vulnerability in web applications where user input is improper handled within the template engine and executed on the server. This exploit can r...

SBUS Signal Analysis and Communication Implementation Using STM32 with Fus Remote Controller

Overview In a recent project, I utilized the SBUS protocol with the Fus remote controller to control a vehicle's basic operations, including movement, lights, and mode switching. This article is aimed...

Leave a Comment

Anonymous

◎Feel free to join the discussion and share your thoughts.