Раздел II: Настройка
Часть 4: Синхронизация серверов с RYSNC и SSH
This chapter describes one method of automating the copying of data and configuration files from one server to another. In its simplest form, synchronizing the data on two (or more) servers is just a matter of copying files from one server to another. One server acts as a primary repository for data, and changes to the data can only be made on this server (in a high-availability configuration, only one server owns a resource at any given point in time). A regularly scheduled copy utility then sends the data after it has been changed on the primary server to the backup server so it is ready to take ownership of the resource if the primary server crashes.
In a cluster configuration all nodes need to access and modify shared data (all cluster nodes offer the same services), so you will probably not use this method of data synchronization on the nodes inside the cluster. You can, however, use the method of data synchronization described in this chapter on highly available server pairs to copy data and configuration files that change infrequently.
rsync
The open source software package rsync that ships with the Red Hat distribution allows you to copy data from one server to another over a normal network connection. rsync is more than a replacement for a simple file copy utility, however, because it adds the following features:
-
Examines the source files and only copies blocks of data that change.[1]
-
(Optionally) works with the secure shell to encrypt data before it passes over the network.
-
Allows you to compress the data before sending it over the network.
-
Will automatically remove files on the destination system when they are removed from the source system.
-
Allows you to throttle the data transfer speed for WAN connections.
-
Has the ability to copy device files (which is one of the capabilities that enables system cloning as described in the next chapter).
Online documentation for the rsync project is available at http://samba.anu.edu.au/rsync (and on your system by typing man rsync).
| Note |
rsync must (as of version 2.4.6) run on a system with enough memory to hold about 100 bytes of data per file being transferred.
|
rsync can either push or pull files from the other computer (both must have the rsync software installed on them). In this chapter, we will push files from one server to another in order to synchronize their data. In Chapter 5, however, rsync is used to pull data off of a server.
Because we want to automate the process of sending data (using a regularly scheduled cron job) we also need a secure method of pushing files to the backup server without typing in a password each time we run rsync. Fortunately, we can accomplish this using the features of the Secure Shell (SSH) program.
|
|