How to promote a NIS+ root replica server to a root master server

How to promote a NIS+ root replica server to a root master server


NOTE: In the following examples, <master> indicates the name of the old
master server, <replica> indicates the name of the old replica server,
and `domainname` indicates the domainname. Items such as <rpc.nisd pid>
indicate the pid for the given process, obtained with the following
command:

ps -ef | grep <processname>

All other punctuation should be typed as written.


1 - Create master's objects for replica:

On Master machine:
# nsmkdir -m <replica> groups_dir.`domainname`.
# nsmkdir -m <replica> org_dir.`domainname`.
# nsmkdir -m <replica> `domainname`.

2 - Copy root.object of master

On Replica machine:
# rcp <master>:/var/nis/<master>root.object /var/nis/<replica>
or for greater than Solaris 2.5
# rcp <master>:/var/nis/<data>root.object /var/nis/<data>

Move root.object from master /var/nis/[<master>|data] directory to somewhere
else (don't delete it as you may need to reverse the process if it
goes wrong)

3 - Kill rpc.nisd and nis_cachemgr on both master and replica:

# kill <rpc.nisd pid> <nis_cachemgr pid>

4 - Restart rpc.nisd and nis_cachemgr on the new replica server:

On new replica machine:
# /usr/sbin/rpc.nisd -S 0
# /usr/sbin/nis_cachemgr -i

5 - Access the domainname directory and verify that the old replica is
now the master:

On new master machine:
# nisshowcache -v
# niscat -o groups_dir.`domainname`.
# niscat -o org_dir.`domainname`.
# niscat -o `domainname`.

6 - If the contents of the cache still shows the old master server to be
the old master, do the following on the new master:

# nsmkdir -m <newmaster> groups_dir.`domainname`.
# nsmkdir -m <newmaster> org_dir.`domainname`.

7 - Change the ownership of the directories

# nischown <newmaster> groups_dir.`domainname`.
# nischown <newmaster> org_dir.`domainname`.

8 - Change the ownership of all the tables within the directories

# for tables in `nisls org_dir | grep -v org_dir`
> do
> nischown <newmaster> $tables.org_dir
> done
# for tables in `nisls groups_dir | grep -v groups_dir`
> do
> nischown <newmaster> $tables.groups_dir
> done

9 - Check the tables and directory structures are owned by the correct
newmaster

# niscat -o org_dir
# niscat -o hosts.org_dir etc...

10 - Remove the old replica from replicating the directory structures

# nisrmdir -s <oldmaster> groups_dir.`domainname`.
# nisrmdir -s <oldmaster> org_dir.`domainname`.
# nisrmdir -s <oldmaster> `domainname`.

11 - Checkpoint the domain

# nisping -C groups_dir.`domainname`.
# nisping -C org_dir.`domainname`.
# nisping -C `domainname`.

12 - If they are all now owned and replicated by the correct machine,
stop and restart rpc.nisd in security level 2

# kill <rpc.nisd pid> <nis_cachemgr pid>
# /usr/sbin/rpc.nisd
# /usr/sbin/nis_cachemgr -i

13 - Check as users and root that all is well.

14 - On the old master, clear out the old info and make it a client of
the domain
Remove everything from /var/nis except NIS_COLD_START and
NIS_SHARED_DIRCACHE.
Put the name and IP number of the new master in the /etc/hosts
file.
# nisinit -c -H <newmaster>

15 - Make the old master a replica of the domain

On the new replica, start rpc.nisd.

On the master

# nismkdir -s <replica> groups_dir.`domainname`.
# nismkdir -s <replica> org_dir.`domainname`.
# nismkdir -s <replica> `domainname`.

# nisping -C groups_dir.`domainname`. (note: server busy messages are
# nisping -C org_dir.`domainname`. (generated because the previous
# nisping -C `domainname`. (command has not finished.

16 - On each client, kill nis_cachemgr

# kill <nis_cachemgr pid>

17 - On each client, get a new coldstart file from the new master server

# nisinit -c -H <newmaster>

18 - On each client, restart nis_cachemgr

# kill <nis_cachemgr pid>
# /usr/sbin/nis_cachemgr -i



Home
FAQ