Command [04] rsync Data Synchronization

Source: Internet
Author: User
Tags rsync usage

There are many ways to synchronize data between two servers. My principle has always been enough. Using Rsync is more than enough to deal with the current project, and there is no need to build a more complex framework. The Rsync usage recorded here is quite a shanty, but it just records the experience that has been found out at ordinary times. If you really need to strictly use rsync in the future, sort it back. Now, let's take a look.

Assume the Application Scenario: synchronize data from 172.30.27.23 to 172.30.27.24

Step 1: A simple synchronization script. The script runs on 172.30.27.23 and adds it to crontab for timed data synchronization.

#! /Bin/sh
Rsync-vrtopg -- Progress/home/Kevin/attached/rsync_user@172.30.27.24: attached>/home/Kevin/logs/rsync. Log

Save the script as/home/Kevin/rsync. Sh.
Resolution: rsync-vrtopg-Progress send file directory the server allows the user to @ Server IP: server configuration item

Step 2: timed synchronization at the sending end
Command: crontab-e
Write: */2 ***** sh/home/Kevin/rsync. Sh

Step 3: Configure the server
Command: VI/etc/rsyncd. conf
Edit permitted address: hosts allow = 172.16.71.78 172.30.27.23
172.16.71.78 is an existing IP address. If multiple addresses exist, separate them with spaces.
In configuration Configuration:

[Attached] Path =/home/receive_filesread only = nouid = rsync_usergid = users

Attached: the server configuration item mentioned above"

Path: storage path of the received File

Read Only = No: read/write allowed

UID: User name used for synchronization

GID: User Group

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.