Rsync
Rsync is a data backup tool under Linux that supports remote synchronization and local replication.
This is a simple use of rsync article, many of Rsync's lack of understanding, more rsync knowledge please
To the Rsync website: https://rsync.samba.org/how-rsync-works.html
Rsyrsync is the system that comes with it (at least 2.6 cores are like this), if the kernel that is not compiled by itself should be self-brought.
Check for an installation Rpm-qa | grep rsync
If it is not installed, download the RPM package yourself or use Yum to install it, this is not shown here.
Configuring the Rsync Service
Vim/etc/xinetd.d/rsync
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/72/4F/wKiom1XgG4-TeBUtAADqSAI8iKE005.jpg "title=" Picture 1.png "alt=" Wkiom1xgg4-tebutaadqsai8ike005.jpg "/>
Change disable's Yes to No
Set Rsync to boot
Chkconfig--level rsync on
Two ways to synchronize Rsync
One is one-time synchronization
One is multiple times (timed synchronization every day)
Single synchronization as long as both the server and the client turn on the rsync service
Use the rsync command to synchronize
For example:
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/72/4B/wKioL1XgH2KhKVnRAAD-nf5NQKk692.jpg "title=" 6.png " alt= "Wkiol1xgh2khkvnraad-nf5nqkk692.jpg"/>
Enter the root password for the 15.5
This synchronizes the rsync.sh data from the 15.5 servers.
This is similar to the SCP.
The following settings are synchronized on a daily schedule
cd/etc/
mkdir RSYNCD
Touch rsyncd.conf //rsync's master configuration file
Touch RSYNCD.MOTD welcome information for//rsync
Touch Rsyncd.secrets //rsync User's password file
Vim rsyncd.secrets//file to write user and password: delimited
Kingvon:test
chmod rsyncd.secrets
Configuring the master configuration file for rsync
Vim/etc/rsyncd/rsyncd.conf
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/72/4B/wKioL1XgHh_APNGAAAE-eA3Yvxw421.jpg "title=" Picture 3.png "alt=" Wkiol1xghh_apngaaae-ea3yvxw421.jpg "/>
The first half is the global setting
Port //Set the port of rsync
UID //Users running the rsync daemon
GID // the group running the rsync Daemon
Use chroot //Do not use chroot
Strict Modes //Whether to check password
Read only //Whether read-only
The lock file//Specifies the locking files that support the maximum concurrency parameter.
Log File//logfile
PID file/daemon pid files
The following is the module setup
[TMP] // Here the name of the authentication module, which needs to be specified on the client side
Path /// directories that need to be synchronized
Ignore Errors // ignore some unrelated io errors
Auth Users // authenticated user name, this user is not related to the system do not go to useradd
hosts allow // allowed host or network segment
hosts Deny // Forbidden Host or network segment
Secrets File //rsync user password file
after configuring the rsyncd.conf .
and make a connection.
Ln-s/etc/rsyncd/rsyncd.conf/etc/rsyncd.conf
Because rsync will only look for /etc/rsyncd.conf files .
If there is /etc/rsyncd.conf, and there is data inside the file
Rsync will take /etc/rsyncd.conf as the standard
If this connection is not established, rsync cannot find the configuration file
errors are prompted when synchronizing with rsync
Rsync:read error:connection Reset by Peer (104)
Rsync Error:error in Rsync protocol data Stream (code) at IO.C (759) [receiver=3.0.6]
Close or configure Iptabeles
Turn on the 873 Port or close the iptables directly
Because I'm a samba server, I'm using an internal network, so I closed the iptables before.
Client-side settings
Install rsync .
Set the rsync boot up
Edit User Password file
Vim/etc/rsyncd/ryncd.secrets
Kingvon:test
Here are Some common parameters of the rsync command
-A Archive mode to recursively transfer files and preserve properties
- R subdirectories are processed in recursive mode
- R Using relative Paths
- P maintain permissions on files
- o owners of owner files
- G group files belong to groups
- T time to hold the file (atime,ctime)
- Z Compress transfers on file transfers
--progress Transfer process at transfer time
--password-file parameters for password text
- H Show Help
More parameters please Google
Use the rsync command to synchronize
/USR/BIN/RSYNC-AZRTOPG--progress--delete [email protected]::tmp/opt/--password-file=/etc/rsyncd/rsyncd.secrets
Write a script to automate
vim/root/backup.sh
#!/bin/bash
/USR/BIN/RSYNC-AZRTOPG--progress--delete [email protected]::tmp/opt/--password-file=/etc/rsyncd/rsyncd.secrets
chmod 755 backup.sh
Crontab-e
To set the execution time
* 1 * * * /root/backup.sh
automatic synchronization at 1 points per day
This article is from the "Fly to Capetown" blog, please be sure to keep this source http://capetowns.blog.51cto.com/8244664/1689336
Linux File Sync Tool rsync