Rsync is a data image and backup tool that provides functions such as fast image synchronization and remote data backup between local and remote files and directories. During the synchronization process, rsync only synchronizes the changed files based on its own unique algorithm, and even only synchronizes the changed parts in a file, so it can implement the fast data synchronization function. (The simple rsync synchronization method described below depends on the SSH service)
[Root @ web ~] # Rsync-asvl/home/* root@192.168.0.253:/home/
The system prompts you to enter the root password of the remote host 192.168.0.253. after entering the password, you can start data synchronization.
Parameter description:
A: Keep all attributes and permissions of the file unchanged.
S: effectively process scattered files.
V: outputs each action of a command in detail.
H: Keep the hard link of the file.
The above red mark indicates the source file location, and the blue mark indicates the destination location. If you want to keep the files on both sides consistent after each synchronization, you need to add the -- delete parameter. When adding this parameter, you must pay attention to the test. Otherwise, the data will be deleted due to serious consequences. In the preceding command, you need to enter the root user password of the 192.168.0.253 machine during execution. You can trust the two machines to save the need to enter the password each time.
[Root @ web ~] # Ssh-keygen-t rsa; create a certificate
[Root @ web ~] # Scp/root/. ssh/id_rsa.pub root@192.168.0.253:/root/. ssh/authorized_keys; copy the public key to the remote host
[Root @ web ~] # Ssh 192.168.0.253; test whether the establishment is successful (whether the password is required)
Author: "technology changes the future"