Linux Advanced tips: rsync sync (i)

Source: Internet
Author: User

1.rsync Introduction

rsyncis a UNIX application, it can update the files and directories of two computers synchronously, and make use of the differential coding to reduce the data transmission. One of the important features of rsync that is not seen in most other similar programs or protocols is that mirroring only needs to be sent once for each target. Rsync can copy/display directory attributes, as well as copy files, and optionally compress and recursively copy.

Here is an illustration of rsync:


2. Build rsync Service:

Precautions:
1. To do this experiment, use three nodes, where node 1 is the machine that synchronizes outward. The contents of the other two synchronization node 1.
2. Do the time synchronization, the firewall shuts down, SELinux also best off (for the convenience of experiment).
3. Set the Yum source (add high-availability packages).

Is the console of our experiment:


1. First we want to install rsync,redhat6.5 the system Yum source has already added rsync, so we can install directly:


To set its configuration file:


To explain the above, we set the Access user and group to root, the maximum number of connections is 36000, the directory is not allowed to change, then we set the log directory, process and lock files. The following content structure is very similar to the writing of NFS, with published catalogs, descriptions, and read-write and object-oriented.

When starting this service we will install the XINETD Daemon service because rsync is a background process. So you have to rely on xinetd to start.


Modify the configuration file for rsync under Daemon to open the service:


Set the disable to no turn on service.


We can see that after restarting the XINETD service our rsync has also been turned on:


Install the HTTPD service to test:


Modify our rsync configuration file to set the Sync directory to the default publishing directory for httpd:


Installing the software on the 192.168.2.102Sersync(Packages need to be downloaded online):


To modify the Sersync configuration file:




Create the directories and files that you want to synchronize:


Turn on the Sersync daemon on the primary server, enable Sersync to run in the background, and turn on real-time synchronization.


Then we access the 192.168.2.103 through the browser, we can find that the content displayed is actually 192.168.2.102://opt/tongbu/index.html content. Just 192.168.2.103 synced to HTTPd's default publish content.

3. Summary:

This is a simple synchronization method, very practical. Next we will explain the deeper uses of rsync.






Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.