Solution for real-time synchronous backup of Enterprise Linux server data

Source: Internet
Author: User
Tags file system ftp inotify file permissions rsync backup linux

Data is the most valuable property! The company's servers are required to have a complete backup strategy for the data, using scripts, planning tasks, open source software, and so on, regardless of that way, to real-time synchronization of data, is the most ideal effect! The following details the use of rsync with inotify to achieve real-time data triggering synchronization.

Rsync: Can be mirrored to save the entire tree and file system. It is easy to maintain the original file permissions, time, soft and hard links and so on. At the first synchronization, rsync copies the entire contents, but only the modified files are transferred the next time.

Scenario: Initially using rsync data backup is the use of planning tasks, the timing of the implementation of the command to achieve rsync synchronization, but recently developed this side of the change more frequently, it seems to need real-time synchronous backup to improve the backup mechanism! So need to use inotify trigger to improve! Sync it up once you have a new change in the position you specified!

Environment:

CentOS 6.4 64-bit

rsync-3.0.9

inotify-tools-3.14

Description

10.10.1.6 (rsync+inotify)----------Web site program (/data0/htdocs/)

10.10.1.9 (rsync)------------------Web site program Backup (/data0/htdocs/)

Objective:

Any changes in the/data0/htdocs/directory that implement 10.10.1.6 will be synchronized to 10.10.1.9/data0/htdocs/in real time

(another, both of these are running Keepalived+nginx, to achieve the failure of automatic failover disaster, detailed configuration will be in the back to fill)

First, Web server 10.10.1.6 (rsync+inotify)

1. Prepare Package

# Mkdir/data/ftpdata

# wget http://rsync.samba.org/ftp/rsync/rsync-3.0.9.tar.gz

# wget http://cloud.github.com/downloads/rvoicilas/inotify-tools/inotify-tools-3.14.tar.gz

2. Install Rsync

TAR-ZXVF rsync-3.0.9.tar.gz

cdrsync-3.0.9

./configure--prefix=/usr/local/rsync

Make;makeinstall

Establish Password Authentication file

[Root@ftp ~]# echo "111111" >/etc/rsyncd/rsyncd.secrets Establish password Authentication file

* 111111 can set their own password, rsyncd.secrets name can also set their own;

Permissions: To set the/etc/rsyncd/rsyncd.secrets to root, with a permission of 600.

# chmod 600/etc/rsyncd/rsyncd.secrets

3. Installation INotify

TAR-ZXVF inotify-tools-3.14.tar.gz

cdinotify-tools-3.14

./configure--prefix=/usr/local/inotify

Make;makeinstall

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.