Usage of rsync

Source: Internet
Author: User

One, usage example 1, incremental backup local file
#rsync-av ebook/tmp///Note: It is best not to have the file name:
#rsync-AVZRTOPGL--PROGRESS/SRC/DST

2. Local and Remote directory synchronization
#rsync-AUV--delete Program doc/media/cbdisk/project///sync to USB drive
#rsync-AUV--delete program doc [email protected]:/home/cb/doc/working/project///and remote host synchronization, you need to enter the remote host password
#rsync-auv--delete-e SSH program doc [email protected]:/home/cb/doc/working/project///and remote host synchronization, you can set SSH login remote host without password, You do not need to enter a remote host password

3. RSYNC+SSH Application Example
Case Requirements:
1) Synchronize the/data/ubuntu directory on the remote host cb251 to the native/data directory as root
2) When the synchronization is complete, the remote host cb251 shutdown
3) shut down your computer

#rsync-auv-e ssh [email protected]:/data/ubuntu/data/;sync; SSH [email protected]/sbin/shutdown-h now;/sbin/shutdown-h now

No password login remote host cb251 Please refer to SSH login remote host without password

4. Exclusion
Rsync-auv--delete--exclude '. Git ' $SRC _dir/program $DEST _disk/project/
Second, the common options to explain-V is "--verbose", that is verbose mode output
-Z means "--compress", which compresses the data as it is transmitted
-R means "--recursive", that is, the subdirectory is processed in recursive mode
-T is "--time", that is, keeping the file time information
-O means "owner", which is used to keep the file owner information
-P is "perms" to maintain file permissions
-G is a "group" that is used to keep the file's group information
-L is "copy-links" and transmits the actual file of the link
The--delete option specifies that data mirroring is synchronized based on the rsync server side, that is, to keep the rsync server-side directory fully consistent with the client directory
The--exclude option is used to exclude file types that do not need to be transferred
The--progress option is used to show the process of data mirroring synchronization
Third, the advantages and disadvantages of rsync 1, the advantages and traditional CP, tar backup method, rsync with high security, backup quickly, support incremental backup and other advantages, through rsync can solve the real-time requirements of low-demand data backup requirements, for example, regularly back up file server data to the remote server, Periodic data mirroring of local disks, and so on. 2, insufficient sync to do data synchronization, you need to scan all the files after the comparison, and then carry out the differential transmission. If the file is large, the sweep file is very time-consuming, and the changed files are often a very small part, so rsync is a very inefficient way. Second, rsync cannot monitor and synchronize the data in real time, although it can trigger the synchronization through the Linux daemon, but there will be a time difference between the two triggering actions, which may result in inconsistent server-side and client data.

Usage of 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.