9.6 Managing Distributed ServersLarge networks have multiple servers. As noted earlier, the servers are often distributed around the network with a server on every subnet. This improves booting efficiency, but it conflicts with the goal of central configuration control. The more servers, the more dispersed the control, and the more likely that a configuration error will occur. Implementing distributed servers requires a technique for maintaining central control and coordinating configuration information among the servers. TCP/IP offers several techniques for doing this. Any file transfer protocol can be used to move configuration data, or any other kind of data, from a central system to a group of distributed systems. Either FTP or TFTP will work, but both of these protocols present difficulties when used in this way. FTP and TFTP are interactive protocols; both require multiple commands to retrieve a file, making them difficult to script. Additionally, FTP requires password authentication before it grants access to a file and most security experts frown on storing passwords inside of scripts. For these reasons we don't concentrate on using these protocols to distribute the configuration file. Besides, if you know how to use FTP (and you should!), you know how to use it to send a configuration file. Another possibility is to use Network File System (NFS) to distribute the information. NFS allows files on the server to be used by clients as if they are local files. It is a powerful tool, but it does have limitations when used to distribute configuration information to boot servers. The same power outage that affects the distributed servers can cause the central server to crash. The distributed servers and their clients can be delayed in booting waiting for the central server to come back online. Sharing a single copy of the configuration file conflicts with the effort to distribute boot services because it puts too much reliance on the central server. One way to avoid this problem is for the distributed servers to periodically copy the configuration file from the mounted filesystem to a local disk. This is very simple to script, but it creates the possibility that the servers will be "out of sync" at certain times - the distributed servers copy the configuration file on a periodic schedule without knowing if, in the interim, the master file has been updated. Of course, it is possible for all of the remote servers to export filesystems that the central server mounts. It is then possible for the central server to copy the configuration file directly to the remote filesystems whenever the master file is updated. However, there are easier ways to do this. The UNIX r -commands rcp and rdist provide the most popular methods for distributing the configuration file. Remote copy ( rcp ) is simply a file transfer protocol. It has two advantages over FTP for this particular application: it is easy to script and it does not require a password. rcp is easy to script because only a single line is needed to complete a transfer. An example of transferring the file bootptab from the master server to a remote server named pistachio.nuts.com is:
# rcp /etc/bootptab pistachio.nuts.com:/etc/bootptab For every remote server that the file is sent to, add a line like the one shown above to the procedure that updates the master configuration file. rcp is only one choice for distributing the central configuration file. rdist , while a little harder to use, is often a better choice because it has several features that make it particularly well suited for this application. 9.6.1 rdistThe Remote File Distribution Program ( rdist ) is designed to maintain identical copies of files on multiple hosts. A single rdist command can distribute several different files to many different hosts. It does this by following the instructions stored in an rdist configuration files called a Distfile . The function of a Distfile is similar to that of the Makefile used by the make command, and it has a similar syntax and structure. Now, don't panic! It's not that bad. The initial configuration of an rdist command is more difficult than the straightforward syntax of an rcp command, but the rdist command provides much more control and is much easier to maintain in the long run. A Distfile is composed of macros and primitives . Macros can be assigned a single value or a list of values. If a list of values is used, the list is enclosed in parentheses, e.g., macro = ( value value ) . Once assigned a value, the macro is referenced using the syntax ${ macro } , where macro is the name of the macro. The other components of a Distfile , the primitives, are explained in Table 9.4 [11]
The simplest way to understand how the primitives and macros are combined to make a functioning Distfile is to look at a sample. The following configuration file distributes the current version of bootpd and the latest bootptab configuration file to the remote boot servers pecan , pistachio , and cashew :
HOSTS = ( pecan root@cashew pistachio ) FILES = ( /usr/etc/bootpd /etc/bootptab ) ${FILES} -> ${HOSTS} install ; notify craig@almond.nuts.com Let's look at each line of the file:
Additional files and hosts can be easily added to this file. In the long run most people find rdist the simplest way to distribute multiple files to multiple hosts. One final note: the configuration file does not have to be called Distfile . Any file name can be specified on the rdist command line using the -f option. For example, the Distfile shown above could be saved under the name bootp.dist and invoked with the following command:
% rdist -f bootp.dist |
|