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