Hot search terms: 360 Security Guard Office365 360 browser WPS Office iQiyi Huawei Cloud Market Tencent Cloud Store
operating system Storage: 1158720KB Time: 2014-04-22
Software Introduction: Ubuntu is a freely distributed and open source Linux-based operating system designed for humans, humans who have no previous experience with Linux...
In Linux systems, real-time synchronization of system data can be achieved through Rsync+sersync, which is more practical than the Rsync+Inotify-tools architecture. This article mainly introduces the detailed steps for installing rsync and sersync in Linux systems to achieve real-time data synchronization. Please refer to it for reference.
1. Why use Rsync+sersync architecture?
1. sersync is developed based on Inotify, a tool similar to Inotify-tools
2. Sersync can record the name of a specific file or directory that has changed (including addition, deletion, modification) in the monitored directory, and then when using rsync to synchronize, only the changed file or directory will be synchronized.
2. What is the difference between the two architectures Rsync+Inotify-tools and Rsync+sersync?
1. Rsync+Inotify-tools
(1): Inotify-tools can only record changes (including additions, deletions, and modifications) to the monitored directory, but does not record the specific files or directories that have changed;
(2): When rsync synchronizes, it does not know which file or directory has changed. It synchronizes the entire directory every time. When the amount of data is large, synchronization of the entire directory is very time-consuming (rsync requires Traverse the entire directory to find comparison files), so the efficiency is very low.
2. Rsync+sersync
(1): sersync can record the name of a specific file or directory that has changed (including addition, deletion, modification) in the monitored directory;
(2): When rsync synchronizes, it only synchronizes the changed file or directory (the data that changes each time is very small compared to the entire synchronized directory data. When rsync traverses and searches for comparison files, it is very fast. Fast), therefore, very efficient.
System Home editor reminds: 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 (hundreds of G or even more than 1T) and there are many files, it is recommended to use Rsync+sersync.
illustrate:
Operating system: CentOS 5.X
Source server: 192.168.21.129
Target server: 192.168.21.127, 192.168.21.128
Purpose: Synchronize the /home/www.jb51.net directory on the source server to /home/www.jb51.net on the target server in real time
Specific operations:
Part 1: Operate on two target servers 192.168.21.127 and 192.168.21.128 respectively
1. Install Rsync server on two target servers respectively.
1. Close SELINUX
vi /etc/selinux/config #Edit firewall configuration file
The code is as follows:
#SELINUX=enforcing #Comment out
#SELINUXTYPE=targeted #Comment out
SELINUX=disabled #Add
:wq! #Save and exit
setenforce 0 #Take effect immediately
2. Open firewall tcp port 873 (Rsync default port)
vi /etc/sysconfig/iptables #Edit firewall configuration file
The code is as follows:
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 873 -j ACCEPT
:wq! #Save and exit
/etc/init.d/iptables restart #Finally restart the firewall to make the configuration take effect
3. Install Rsync server software
yum install rsync xinetd #Install
vi /etc/xinetd.d/rsync #Edit the configuration file and set up rsync on boot
The code is as follows:
disable = no #Change to no
:wq! #Save and exit
/etc/init.d/xinetd start #Start (Xinetd is used to manage the Rsync service in CentOS)
How to set up safe decompression of files in 360 Secure Browser? -How to set up safe decompression of files in 360 Secure Browser
How to install plug-in for 360 Secure Browser? -How to install plug-ins for 360 Secure Browser
How to clear the cache of 360 Secure Browser? -How to clear the cache of 360 Safe Browser
How to upgrade 360 Secure Browser? -How to upgrade the version of 360 Secure Browser
How to switch accounts to log in to iQiyi? -How to log in to iQiyi account switching account
What to do if there is no sound after reinstalling the computer system - Driver Wizard Tutorial
How to practice typing with Kingsoft Typing Guide - How to practice typing with Kingsoft Typing Guide
How to upgrade the bootcamp driver? How to upgrade the bootcamp driver
How to change QQ music skin? -QQ music skin change method
Driver President Download-How to solve the problem when downloading driver software is very slow