Advanced NIS administration

Changing a map's master server

To change a map's master, you first have to build it on the new NIS master. The old master's name occurs as a key-value pair in the existing map (this pair is inserted automatically by makedbm). Therefore, using the existing copy at the new master or transferring a copy to the new master with ypxfr is insufficient. You have to reassociate the key with the new master's name. If the map has an ASCII source file, you should copy it in its current version to the new master.

Here is the procedure for remaking a sample NIS map called jokes.bypunchline.

  1. Log in to the new master as NIS administrator and enter:

    cd /var/yp

  2. /var/yp/Makefile must have an entry for the new map before you specify the map to ypbuild. If this is not the case, edit the Makefile as described in ``Making the maps''.

  3. Enter:

    ./ypbuild jokes.bypunchline

  4. If the old master will remain an NIS server, rlogin in to it and edit /var/yp/Makefile. Comment out the section of /var/yp/Makefile that made jokes.bypunchline so that it is no longer made there.

  5. If jokes.bypunchline only exists as a dbm file, remake it on the new master by disassembling a copy from any NIS server using makedbm with the -u option, then running the disassembled version through makedbm:

    cd /var/yp
    ypcat -k jokes.bypunchline | \
    /usr/sbin/makedbm - domainname/jokes.bypunchline

    Do not forget that jokes.bypunchline should be in the alias file too.

After making the map on the new master, you must send a copy of it to the other slave servers. However, do not use yppush, as the other slaves will try to get new copies from the old master, rather than the new one. A typical method for circumventing this is to transfer a copy of the map from the new master back to the old master. Become NIS administrator on the old master server and enter:

/usr/sbin/ypxfr -h newmaster jokes.bypunchline

Now it is safe to run yppush. The remaining slave servers still believe that the old master is the current master. They will attempt to get the current version of the map from the old master. When they do so, they will get the new map, which names the new master as the current master.

If this method fails, you can try this cumbersome but reliable option: log in as NIS administrator on each NIS server and execute the ypxfr command shown previously in this section.

© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 22 April 2004