Understanding Distribution Issues

If you must maintain multiple application servers and need to copy application packages (or entire file systems) from one to another, you probably want to become familiar with the rdist(1) command. It is a standard command specially designed for synchronizing file systems or portions of file systems between remote hosts. One of rdist's great advantages is that it compares the status of files between the source and destination systems and copies only those files that need updating. This procedure is more efficient in many cases than using tar, for example, which copies all files unconditionally.

Unfortunately, the manual page for rdist does not provide clear guidelines for how to begin simply and scale to more sophisticated formats. The following paragraphs provide some suggestions for how to begin.

NOTE

Be sure to begin with controlled experimentation in a test environment and study of the rdist manual page so that you are not unpleasantly surprised by unexpected results.


To be able to use rdist to copy from one system to another depends on some level of trusted host relationship. (That is, the UID using rdist must be able to log in to the remote system without a password.) You may want this account to be owned by a UID other than root.

Once this privilege exists, you can use rdist to copy a hierarchy from the local system to the same destination on the remote system with a command as simple as the following.

$ rdist -c /usr/apps
						remote-system
					

Perhaps the most common form of rdist is to refer to a file that lists the target host systems and the path names to be synchronized. When the file has been created, use the following syntax.

$ rdist -f
						distfile
					

You may encounter limitations because rdist distfiles cannot use actual shell variables for flexibility. You can work around this limitation, however, by creating a script in which the shell expands variables before feeding the resulting syntax to rdist. The format of such a script, shown here, is the beginning of the power needed to use rdist to perform flexible, selective updates.

#!/bin/sh
files="
pathname1
pathname2
. . .
"
hosts="
host1
host2
. . .
"
rdist -f - <<-EOrdist
("$files") -> ("$hosts")
EOrdist

NOTE

Beware of using rcp -r to copy hierarchies. In the process, symbolic links get converted to actual copies of their destination files. This conversion not only can affect the amount of space occupied, but can produce unexpected behavior. You may later make changes to link destination files, such as wrappers, not realizing that command names have become outdated copies of the script itself. Also, rcp does not replicate UID, GID, or permissions.


..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.17.166.233