Linux System Management Preliminary (eight) data Backup tool rsync

Source: Internet
Author: User
Tags rsync

Rsync Tools

The Rsync tool is used to synchronize folder data, unlike the CP command, which can handle real-time changes in files, synchronizing source and target data directories, and not processing the same portion of data for two directories.

I. SUMMARY OF TOOLS

Command wording
The next SRC is the abbreviation of source, dest is the abbreviation of destination

rsync-Option Source directory path (target host user name) @ Destination IP address: Destination directory path
Rsync-Options ... src [src] ... Target path
Rsync-Options ... src [src] ... [[email protected]] Host:dest
Rsync-Options ... src [src] ... [[email protected]] HOST::D EST
Rsync-Options ... src [src] ... rsync://[[email protected]]host[:P ort]/dest
Rsync-Options ... [[email protected]] HOST:SRC [DEST]
Rsync-Options ... [[email protected]] HOST::SRC [DEST]
Rsync-Options ... rsync://[[email protected]]host[:P ort]/src [DEST]

Command common options
-A equals to-rtplgod
-R to copy directory, like the-r option when CP
-V detailed synchronization details, let us know the process of synchronization
-L Keep Soft links
-L with this option, the source files are synchronized when the soft link is synchronized
-P Keep File permissions property
-O Keep File owner
-G hold File group
-D Keep Device file information
-T keep file Time properties
--delte Delete files in dest that are not in SRC
--exclude filter the specified file, such as--exclude "logs" will be the file name contains logs files or directories filtered out, not synchronized
-P shows the synchronization process, such as rate, more detailed than-V
-U plus this option, if the files in the target directory are newer than the original directory, the sync
-Z Compression during transfer

Example of an action command:

Points:
1. The "/" symbol must be added at the end when synchronizing folders
2, focus on understanding-a-delte-exclude-u four options

Ii. Examples of rsync command operations

1. Back up the passwd file to a local/tmp/pswd.bak

Rsync-ap/etc/passwd/tmp/pswd.bak

2. Back up the passwd file to 100.100/tmp/208.128.bak

rsync-ap/etc/passwd [Email Protected]:/tmp/208.128.bak

Third, synchronize the folder through SSH

3, configure Authorized_key to achieve free login synchronization

1. Generate SSH key pair

Ssh-keygen

2. Distribute SSH keys to the backup machine

Ssh-copy-id [email protected]

3. Test results

rsync-ap/etc/passwd [Email Protected]:/tmp/208.128.bak

Iv. directory synchronization through the service

Linux System Management Preliminary (eight) data Backup tool rsync

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.