RSync for file backup Synchronization

Source: Internet
Author: User
Tags inotify

RSync for file backup Synchronization

1. rsync Introduction

Rsync is an application software in Unix. It can synchronously update files and directories of two computers and use differential encoding to reduce data transmission. An important feature in rsync that is not seen in most similar programs or protocols is that the image only needs to be sent once for each target. Rsync can copy/display directory attributes, copy files, and perform selective compression and recursive copy.

The diagram of rsync is as follows:

Monitor host files and directories using inotifywait

Using inotify + rsync for Linux File batch update

Inotify-tools + rsync real-time file synchronization installation and configuration

Complete rsync synchronization Configuration

Remote synchronization of Rsync in CentOS 6.5

2. Set up the rsync service:

Note:

1. In this experiment, three nodes are used, of which Node 1 serves as the external synchronization machine. The content of the other two synchronization nodes 1.

2. Do a good job of time synchronization, firewall shutdown, selinux is also recommended to close (to facilitate the experiment ).

3. Set the yum source (add a high-availability package ).

This is the console of our experiment:

1. First, we need to install rsync. rsync has been added to the yum source of the RedHat6.5 system, so we can install it directly:

Set its configuration file:

To explain the above content, we set the access user and group to root, the maximum number of connections is 36000, And the directory cannot be changed. Then we set the log directory, process, and lock files. The structure of the content below is very similar to that of nfs, including published directories, descriptions, and whether to read and write data and object-oriented data.

When starting this service, we need to install the xinetd DAEMON service because rsync is a background process. Therefore, xinetd must be used for startup.

Modify the configuration file of rsync under the daemon to enable the Service:

Set disable to no to enable the Service.

We can see that after the xinetd service is restarted, our rsync has also been enabled:

Install the httpd service for testing:

Modify the rsync configuration file and set the synchronization directory to the default release directory of httpd:

Install the software sersync on 192.168.2.102 (the software package must be downloaded online ):

Modify the sersync configuration file:

Create the Directory and file to be synchronized:

Enable the sersync daemon on the master server to run sersync in the background and enable real-time synchronization.

Then we access 192.168.2.103 through a browser, and we can see that the displayed content is actually the content of 192.168.2.102: // opt/tongbu/index.html. Only 192.168.2.103 is synchronized to the default release content of httpd.

3. Summary:

This is a simple and practical synchronization method. Next we will explain the deeper usage of rsync.

For more details, please continue to read the highlights on the next page:

  • 1
  • 2
  • Next Page

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.