Rsync (synchronize) is a remote data synchronization tool that allows you to quickly synchronize files between multiple hosts by LAN. You can also use rsync to synchronize different directories on your local hard disk. Rsync is a tool to replace RCP, and Rsync uses the so-called rsync algorithm for data synchronization, which transmits only two different parts of the file, rather than sending it all at a time, so it's very fast. You can refer to the How to rsync works A practical Overview to learn more about Rsync's operating mechanism. The initial authors of Rsync are Andrew Tridgell and http://www.aliyun.com/zixun/aggregation/13830.html ">paul Mackerras, currently maintained by Http://rsync.samba.org. Rsync supports most Unix-like systems, both Linux, Solaris, and BSD are well tested. The CentOS system installs the Rsync package by default. In addition, the Windows platform also has a corresponding version, such as Cwrsync and deltacopy. Rsync has the following basic features:
Can be mirrored to save the entire directory tree and file system can easily maintain the original file permissions, time, soft and hard links without special permissions can install the optimization process, file transfer efficiency can be used rsh, SSH way to transfer files, of course, can also through direct socket connection support anonymous transmission, To facilitate the website mirror image
There are two ways to use rsync for remote synchronization: remote Shell mode (which is recommended for SSH, user authentication is responsible for SSH), and C/s mode (that is, the customer connects to the remote rsync server and the user authenticates by the rsync server). Whether the local synchronization directory or the remote synchronization data, the first run will be a copy of all the files once, and later run will only copy the changed files (for new files) or the changes in the file (for the original file). This section focuses on the use of rsync customer commands, as described in the following section for the configuration and use of rsync servers. Rsync does not have the speed advantage at first copy and is not as fast as tar, so you can consider using tar for the first copy when the data is large, and then use rsync for data synchronization.
Mirroring, backup, and archiving
Two scenarios for implementing a backup:
Keep Backup history archive: Keep A historical backup archive at backup time to revert to the previous correct state after a system error. This can be done using full backups and incremental backups. You can use the tar command to save the archive file. To improve backup efficiency, you can also use rsync with tar to complete. No need to keep backup history archive: If you do not need to restore from a historical backup to the correct state, only the most "fresh" state of the system can be backed up. This can be done simply by using rsync synchronization. This is often referred to as mirroring. Mirroring can be divided into two types: The mirrored directory remains in the same location on each host. This is typically done to perform a synchronous mirroring of multiple hosts for load balancing. For example, the/srv/www directory of host A is synchronized to the/srv/www directory of host B, and so on. The mirrored directory does not maintain the same location on each host. For example, both host A and host B run their own business, while mirroring each other. At this point the/srv/www directory of host a synchronizes to the/BACKUPS/HOSTA/WWW directory of Host B, and the/srv/www directory of Host B synchronizes to the/BACKUPS/HOSTB/WWW directory of host A.
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.