Linux remote synchronization data tool rsync

  
        Rsync remote synchronization data tool, is the data backup tool rsync (remote sync) under Linux. Features: Synchronize data locally (similar to cp, but different from remote scp), it will first judge existing data and remote data. What is the difference, the different parts will not be overwritten at the same time rsync uses the format 1.rysnc (command format) format (requires the remote root password) Note: When using the rsync command to synchronize files between two machines, With ssh at the same time, ssh can regenerate a pair of keys with ssh-keygen -t rsa. Public and private keys. If the file of host A is synchronized to host B, a pair of key public keys can be regenerated on ssh-keygen -t rsa on host A: id_rsa.pub is placed on local host A, and private key id_rsa is on remote host B. on. If the host's private key id_rsa and remote host B's id_rsa are not generated pairs. Enter the password and also the package prompt: Server refused our key” Server refused our key” Solution: You can use ssh-keygen -t rsa to regenerate a pair of keys. 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 Recursively transfer the file and keep all the attributes, equivalent to -rlptgoD, the -a option can be followed by a --no-OPTION which means that one of the -rlptgoD is closed - for example -a--no-l is equivalent to -rptgoD - r The subdirectory is processed in recursive mode, mainly for the directory. If you transfer a file separately, you don't need to add -r, but the directory must be transferred with the -r option. -v Print some information, such as rate, number of files. Etc. -l retains the soft link -L handles the soft link as if it were a regular file. If there is a soft link file in the SRC, adding this option will copy the target file pointed to by the soft link to the DST -p hold file. Permissions -o Keep file owner information -g Keep file group information - D Keep device file information -t Keep file time information --delete Delete files that are not available in SRC in DST --exclude=PATTERN Specify to exclude files that do not need to be transferred. The equal sign followed by the file name can be a universal character mode (such as *.txt) --progress During the synchronization process, you can see the status of the synchronized process, such as counting the number of files to be synchronized, the file transfer speed of the synchronization, etc. -u plus this option will put the DST in the SRC New files are excluded and will not be overwritten. The usual option pages are only a few: (-a -v --delete --exclude --no-OPTION) (1) When using rsync to back up directories locally, remember to The directory is followed by /mkdir test1 cd test1 touch 1.txt 2.txt rsync -av test1/test2/# Otherwise, the test/directory is returned to the newly generated test2/. (2)--no-OPTION rsync -av --no-l # Remove soft link (3) Option -L #copy The source file of the soft link is also tested instead of the soft link Host A 192.168.176.252 Host B 192.168.176.253 It is required to synchronize the host's /root/install.log to the host /tmp directory. rsync -avL /root/install.log [email protected]:/tmp Prompts for the host B user root password.
Copyright © Windows knowledge All Rights Reserved