Linux installation and configuration of rsync and sersync methods

  
                

In Linux system, Rsync+sersync can realize real-time synchronization of system data, which is more practical than Rsync+Inotify-tools architecture. The following small series will give you a detailed introduction to the Linux installation and configuration of Rsync+sersync.

First, why use Rsync + sersync architecture?

1,sersync is based on Inotify, similar to the Inotify-tools tool

2, sersync can record changes in the monitored directory (including add, delete, modify) specific The name of a file or a directory, and then use rsync to synchronize, only synchronize the changed file or this directory.

Second, what is the difference between Rsync+Inotify-tools and Rsync+sersync?

1, Rsync+Inotify-tools

(1): Inotify-tools can only record changes to the directory being monitored (including adding, deleting, modifying), and did not put specific Which file or which directory has changed and recorded;

(2): When rsync is synchronized, it does not know which file or which directory has changed, each time the entire directory is changed. Synchronization, when the amount of data is large, the entire directory synchronization is very time consuming (rsync has to traverse the entire directory to find the comparison file), so the efficiency is very low.

2, Rsync+sersync

(1): sersync can record changes in the directory being listened to (including adding, deleting, modifying) the name of a specific file or a directory. ;

(2): When rsync is synchronized, only the changed file or this directory is synchronized (the data changed every time is small relative to the entire synchronous directory data, rsync is traversed to find When comparing files, it is very fast), so it is very efficient.

System Home Xiaobian reminder: When the amount of synchronized directory data is not large, it is recommended to use Rsync+Inotify-tools; when the amount of data is large (several hundred G or even more than 1T), many files, it is recommended Use Rsync+sersync.

Description:

Operating System: CentOS 5.X

Source Server: 192.168.21.129

Target Server: 192.168.21.127,192.168.21.128< Br>

Purpose: Synchronize the /home/www.jb51.net directory on the source server to /home/www.jb51.net in real time.

Specific operations:

The first part: operate on two target servers 192.168.21.127, 192.168.21.128

First, install the Rsync server on the target server in two

1. Close SELINUX

vi /etc/selinux/config #Edit Firewall Configuration File

The code is as follows:

#SELINUX=enforcing #注了

#SELINUXTYPE=targeted #Comment out

SELINUX=disabled #增增

:wq! #Save, exit

setenforce 0 #immediately

2, open the firewall tcp port 873 (Rsync default port)

vi /etc/sysconfig/iptables #edit firewall configuration The file

is as follows:

-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 873 -j ACCEPT

:wq! #SaveExit

/etc/init.d/iptables restart #Restart the firewall to make the configuration take effect

3. Install the Rsync server software

yum install rsync xinetd #Install

vi /etc/xinetd.d/rsync #Edit the configuration file, set the boot rsync

code as follows:

disable = no #change to no

:wq! #SaveExit

/etc/init.d/xinetd start #Startup (CentOS is xinetd to manage Rsync service)
Previous123456Next page Total 6 pages

Copyright © Windows knowledge All Rights Reserved