Linux Remote Data Synchronization tool rsync (1)

Source: Internet
Author: User

Linux Remote Data Synchronization tool rsync (1)
Rsync remote Data Synchronization tool is a data backup tool rsync in linux (remote sync remote synchronization) features: local data synchronization (similar to cp, but different from remote scp ), it first checks whether the existing data is different from the remote data, and overwrites the different data in rsync format. rysnc (Command Format) format (requires a remote root password) Note: When the rsync command is used between two machines to synchronize files, it is used together with ssh, ssh can use ssh-keygen-t rsa to regenerate a pair of keys. Public Key and private key. If you want to synchronize the file of host A to host B, you can use ssh-keygen-t rsa on host A to regenerate A pair of Public Key: id_rsa.pub on host, the private key id_rsa is on the remote host B. If the private key id_rsa of host A and id_rsa of remote host B are not generated. If you enter the password, the system will prompt "Server refused our key". Solution: You can use ssh-keygen-t rsa to generate a key pair. Rsync [OPTION]... src dest (Local to local) rsync [OPTION]... SRC [USER @] HOST: DEST (local remote) rsync [OPTION]... [USER @] HOST: src dest (remote to local) rsync [OPTION]... [USER @] HOST: src dest (remote to local) rsync [OPTION]... SRC [USER @] HOST: DEST (local remote)-a archive mode, indicating that the file is transmitted recursively and all attributes are maintained, which is equivalent to-rlptgoD, -The end of OPTION a can be followed by a -- no-OPTION which indicates to disable-rlptgoD. For example,-a -- no-l is equivalent to-rptgoD-r, this is mainly for directories. If you do not need to add-r to upload a file separately, but you must add the-r option-v to the directory to print some information. For example, speed and number of files-l retain soft links-L process soft links like regular files. If there is a soft connection file in SRC, after this option is added, the target file pointed to by the soft connection will be copied to DST-p to keep the file permission-o to keep the file owner information-g to keep the file group information-D to keep the Device File information-t keep file time information -- delete files not in SRC in DST -- exclude = PATTERN specifies to exclude files that do not need to be transmitted, the equals sign is followed by the file name. It can be in the-Character Mode (for example *. txt) -- progress can see the status of the synchronization process during synchronization, for example, counting the number of files to be synchronized, the synchronization file transfer speed, etc.-u with this option, the new files in DST and SRC will be excluded, there are only a few common OPTION pages not covered: (-a-v -- delete -- exclude -- no-OPTION) (1) when you use rsync to back up the directory locally, remember to add/mkd to the directory. Ir test1 cd test1 touch 1.txt 2.txt rsync-av test1/test2/# Otherwise, the test/directory will return to the newly generated test2/directory. (2) -- no-OPTION rsync-av -- no-l # Remove soft links (3) option-L # copy the soft link source file instead of Soft link host A 192.168.176.252 host B 192.168.176.253 requires/root/install of the host. log is synchronized to rsync-avL/root/install in the/tmp directory of the host. log root@192.168.176.253:/tmp prompts to enter host B User root Password

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.