Solaris Naming Administration Guide

Changing a Map's Master Server

To change the master server for a selected map, you first have to build the map on the new NIS master. Since the old master server name occurs as a key-value pair in the existing map (this pair is inserted automatically by makedbm), copying the map to 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 server name. If the map has an ASCII source file, you should copy this file to the new master.

Here are instructions for remaking a sample NIS map called sites.byname.

  1. Log in to the new master as superuser and type:

    newmaster# cd /var/yp
  2. Makefile must have an entry for the new map before you specify the map to make. If this is not the case, edit the Makefile now.

  3. To update or remake the map, type:

    newmaster# make sites.byname
  4. If the old master remains an NIS server, remote log in (rlogin) to the old master and edit Makefile. Comment out the section of the Makefile that made sites.byname so that it is no longer made there.

  5. If sites.byname only exists as an ndbm file, remake it on the new master by disassembling a copy from any NIS server, then running the disassembled version through makedbm:

    newmaster# cd /var/yp
    newmaster# ypcat -k sites.byname | makedbm -domain/sites.byname

    After making the map on the new master, you must send a copy of the new map to the other slave servers. However, do not use yppush, because 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. To do this, become superuser on the old master server and type:

    oldmaster# /usr/lib/netsvc/yp/ypxfr -h newmaster sites.byname

    Now it is safe to run yppush. The remaining slave servers still believe that the old master is the current master. They 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 sure-fire option: log in as root on each NIS server and execute the ypxfr command shown above.