![]() | ![]() |
The ypcat command line prints the entries in the current ypservers map, then removes the entry for the desired server using grep -v. This shortened list of servers is given to makedbm, which rebuilds the ypservers map. If the decommissioned server is not being shut down permanently, make sure you remove the NIS maps in /var/yp on the former server so that the machine doesn't start ypserv on its next boot and provide out-of-date map information to the network. Many strange problems result if an NIS server is left running with old maps: the server will respond to requests, but may provide incorrect information to the client. After removing the maps and rebuilding ypservers, reboot the former NIS server and check to make sure that ypserv is not running. You may also want to force a map distribution at this point to test the new ypservers map. The yppush commands used in the map distribution should not include the former NIS server.master# cd /var/yp master# ypcat -k ypservers | grep -v servername\ | makedbm - /var/yp/`domainname`/ypservers
Removing all of the timestamp files forces every map to be rebuilt; passing NOPUSH=1 to make prevents the maps from being pushed to other servers. At this point, you have NIS maps that contain master host records pointing to the new NIS master host.newmaster# cd /var/yp newmaster# rm *.time newmaster# make NOPUSH=1
The -h newmaster option tells the old master server to grab the map from the new master server, and the -f flag forces a transfer even if the local version is not out of order with the new map. Every NIS map must be transferred to the old master server. When this step is complete, the old master server's maps all point to the new master server.oldmaster# /usr/lib/netsvc/yp/ypxfr -h newmaster -f passwd.byuid oldmaster# /usr/lib/netsvc/yp/ypxfr -h newmaster -f passwd.byname oldmaster# /usr/lib/netsvc/yp/ypxfr -h newmaster -f hosts.byname ...include all NIS maps...
yppush forces the slave servers to look at their old maps, find the master server (still the old master), and copy the current map from the master server. Because the map itself contains the pointer record to the master server, transferring the entire map automatically updates the slave servers' maps to point to the new master server.oldmaster# /usr/lib/netsvc/yp/yppush passwd.byuid oldmaster# /usr/lib/netsvc/yp/yppush passwd.byname oldmaster# /usr/lib/netsvc/yp/yppush hosts.byname ...include all NIS maps...
The alternative to this method is to rebuild the entire NIS system from scratch, starting with the master server. In the process of building the system, NIS service on the network will be interrupted as slave servers are torn down and rebuilt with new maps.#! /bin/sh MAPS="passwd.byuid passwd.byname hosts.byname ..." NEWMASTER=newmaster for map in $MAPS do echo moving $map /usr/lib/netsvc/yp/ypxfr -h $NEWMASTER -f $map /usr/lib/netsvc/yp/yppush $map done
![]() | ![]() | ![]() |
4.2. Managing map files | ![]() | 4.4. Managing multiple domains |
Copyright © 2002 O'Reilly & Associates. All rights reserved.