There are situations where a NIS+ replica needs to be removed or
recreated (ie reinitialised). For example if the database becomes
corrupted or it becomes out of sync with the master and never
recovers.
The need to recreate a replica is very rare and the state of the
replica should be checked carefully before taking further action.
For example:
If the replica appears to be out of sync with the master it is
recommended that nisping(1M) is used to check that the replica
is truly up to date and is reporting the same last update as
seen on the master.
A further test is to use nisprefadm(1M) or NIS_OPTIONS (see the
Solaris Naming Administration Guide AnswerBook). Using these
tools it is possible to force a client to use a particular
server. Check the results from the master and the replica to
see if there are still inconsistencies.
If it is shown that there is clearly a problem in the replica's
database it should be reinitialised. See the Solaris Naming
Administration Guide AnswerBook and nisrmdir(1) for more details.
The following description assumes a simple NIS+ domain with a root
directory and the standard org_dir and groups_dir directories. It
describes first removing the replica and then recreating it.
As root user on the rootmaster NIS+ system:
1) nisrmdir -f -s <actualreplicaname> org_dir.yourdomainname.
^
you need this end dot
ex: nisrmdir -f -s total org_dir.labs.com.
2) nisrmdir -f -s <actualreplicaname> groups_dir.yourdomainname.
ex: nisrmdir -f -s total groups_dir.labs.com.
3) nisrmdir -f -s <actualreplicaname> yourdomainname.
ex: nisrmdir -f -s total labs.com.
4) nisclient -co <actualreplicaname>
This overwrites creds for the replica
machine, It asks for the root password of the old replica.
As root user on the old replica:
a) rm -r /var/nis/*
b) rm /etc/.rootkey
c) ps -ef | grep nis , kill pids for all rpc.nisd and nis_cachemgr processes
d) nisclient -i -d <yourdomainname.> -h <rootmastername>
ex: nisclient -i -d labs.com. -h woof
If it complains about not being able to find the /var/nis coldstart
file, ignore this.
5) Reboot the old replica (it will now be a NIS+ client only).
To convert the NIS+ client back to a replica, become root user on the
old replica:
1) start rpc.nisd
2) As root user on root master system:
a) nisserver -R -d <yourdomainname.> -h <actualreplicaname>
ex: nisserver -R -d labs.com. -h woof
b) nisping <yourdomainname.>
c) nisping groups_dir.<yourdomainname.>
d) nisping org_dir.<yourdomainname.>
ex: nisping -C org_dir.mdc.com.
e) Reboot the replica