Summary: NIS+ master hostname change

From: Mark Tindall (tindall@lgu.ac.uk)
Date: Fri Aug 01 1997 - 07:05:16 CDT


I had quite a few replies on the subject with the best coming from Greg
Price (as shown below). In the end what I decided to do was to promote a
root replica to the master server and then demote the old master to just a
replica and then a client. This then gives a 0 downtime as all requests
to NIS+ can be handled by the new master server. Here is what I did:-

1.) Dump all NIS+ tables and backup /var/nis directory for safety:

        #!/bin/sh

        #
        # Dump NIS+ tables into ascii files
        #

        TMPDATE=`date +%e%m%y`
        echo $TMPDATE > /usr/ops/datefile
        sed 's/ //g' /usr/ops/datefile > /usr/ops/newdate
        DATE=`cat /usr/ops/newdate`
        DUMPSITE=/dumpdir/nisdump-$DATE
        OUTFILE=/dumpdir/nis-dump-info

        #
        # Make 0 level dump to be safe
        #

        mkdir -p /dumpdir/nisdump-$DATE
        chmod 700 /dumpdir/nisdump-$DATE
        ufsdump 0f - /var/nis | compress -c > $DUMPSITE/nis-dump.Z
        cp /etc/.rootkey $DUMPSITE/dot.rootkey

        echo "passwd...."
        /usr/lib/nis/nisaddent -d passwd > $DUMPSITE/passwd

        echo "shadow...."
        /usr/lib/nis/nisaddent -d shadow > $DUMPSITE/shadow

        echo "hosts...."
        /usr/lib/nis/nisaddent -d hosts > $DUMPSITE/hosts

        echo "ethers...."
        /usr/lib/nis/nisaddent -d ethers > $DUMPSITE/ethers

        echo "aliases...."
        /usr/lib/nis/nisaddent -d aliases > $DUMPSITE/mail_aliases

        echo "netgroup...."
        /usr/lib/nis/nisaddent -d netgroup > $DUMPSITE/netgroup

        echo "protocols...."
        /usr/lib/nis/nisaddent -d protocols > $DUMPSITE/protocols

        echo "services...."
        /usr/lib/nis/nisaddent -d services > $DUMPSITE/services

        echo "group...."
        /usr/lib/nis/nisaddent -d group > $DUMPSITE/group

        echo "bootparams...."
        /usr/lib/nis/nisaddent -d bootparams > $DUMPSITE/bootparams

        echo "netmasks...."
        /usr/lib/nis/nisaddent -d netmasks > $DUMPSITE/netmasks

        echo "timezone...."
        /usr/lib/nis/nisaddent -d timezone > $DUMPSITE/timezone

        echo "rpc...."
        /usr/lib/nis/nisaddent -d rpc > $DUMPSITE/rpc

        echo "networks...."
        /usr/lib/nis/nisaddent -d networks > $DUMPSITE/networks

        # KEY-VALUE TABLES

        echo "auto_home...."
        /usr/lib/nis/nisaddent -d -t auto_home.org_dir key-value >
 $DUMPSITE/auto_home

        echo "auto_master...."
        /usr/lib/nis/nisaddent -d -t auto_master.org_dir key-value >
$DUMPSITE/auto_master

        echo "sendmailvars...."
        /usr/lib/nis/nisaddent -d -t sendmailvars.org_dir key-value >
$DUMPSITE/sendmailvars

        # CRED TABLE ( two invocations )

        echo "cred...."
        /usr/lib/nis/nisaddent -d -t cred.org_dir publickey >
$DUMPSITE/cred_publickey

        /usr/lib/nis/nisaddent -d -t cred.org_dir netid > $DUMPSITE/cred_netid

2.) If you do not have a root replica then create one.
3.) On root master server:

        # nismkdir -m replica org_dir.<NIS+ domain name>.
        # nismkdir -m replica groups_dir.<NIS+ domain name>.
        # nismkdir -m replica groups_dir.<NIS+ domain name>.

4.) On root master and root replica kill rpc.nisd and nis_cachemgr
5.) On old root master copy root.object:

        # cd /var/nis/replica
        # rcp master:/var/nis/master/root.object .

6.) Restart daemons on old root replica:

        # /usr/sbin/rpc.nisd
        # /usr/sbin/nis_cachemgr

7.) Check that old replica has become master:

        # nisstat

8.) On each client kill and restart nis processes:

        # kill -9 <pid of nis_cachemgr>
        # nisinit -c -H new_root_master
        # nis_cachemgr -i

This then should have swapped over the master and the replica. The replica
server can now be removed from the NIS+ namespace:

        # nisrmdir -f -s <replica>.<NIS+ domain name> org_dir
        # nisrmdir -f -s <replica>.<NIS+ domain name> groups_dir
        # nisrmdir -f -s <replica>.<NIS+ domain name> <NIS+ domain name>

This then changes the machine to a simple client, and a sys-unconfig command
can be issued and the name changed from here, or alternatively you can change
the information in /etc/hosts, /etc/hostname.<device name le0 etc.>, NIS+
entries, /etc/nodename, all host files under /etc/net/*.

*****************************************************
* Mark Tindall, Senior Systems Officer *
* *
* London Guildhall University, *
* 100 Minories, *
* Tower Hill, *
* London EC3N 1JY. *
* *
* Tel: 0171-320 1737 *
* Email: tindall@lgu.ac.uk *
*****************************************************



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:11:59 CDT