Sun Microsystems, Inc.
spacerspacer
spacer www.sun.com docs.sun.com |
spacer
black dot
 
 
21.  NIS+ Backup and Restore Backing Up Your Namespace With nisbackup Backup Directory Structure  Previous   Contents   Next 
   
 

Backup Files

The backup target directory contains a backup_list file that lists the NIS+ directory objects most recently backed up to this target directory.

Each of the subdirectories contain two files and a /data subdirectory. The three files are:

  • data.dict. An XDR encoded file containing an NIS+ data dictionary for the NIS+ directory objects backed up to this directory.

  • last.upd. A binary file containing time-stamp information about the NIS+ directory object backed up to this directory.

Each of the /data subdirectories contain one or more of the following files:

  • root.object. An XDR encoded data file containing a description of the NIS+ root directory object. For example, /master1_bakup/doc.com/data/root.object.

  • root_dir. An XDR encoded file containing a description of NIS+ objects contained in the root directory and server information for those objects. For example, /master1_bakup/doc.com/data/root_dir.

  • table.directory. An XDR encoded file containing the data that was present in an NIS+ table at the time the backup was performed and also any data contained in any associated NIS+ log files. If there is an NIS+ table in the NIS+ directory object being backed up, a corresponding table.directory backup file will be created in the /data subdirectory for that directory object.

    For example, every NIS+ org_dir directory contains a hosts table so there will be a hosts.org_dir file in each target/org_dir.domain/data subdirectory. For example, /master1_bakup/org_dir.doc.com./data/hosts.org_dir

    User-created NIS+ tables present in a given directory object are backed up in the same way as the standard NIS+ tables.

  • groups_dir. An XDR encoded file containing NIS+ groups information. This file is stored in the corresponding NIS+ groups_dir target directory.

Restoring Your NIS+ Namespace With nisrestore

The nisrestore command recreates NIS+ directory objects to match the data stored in backup files created with the nisbackup command. This command can be used to restore NIS+ servers, replace directory objects that have become corrupted, or down load NIS+ data on to a new NIS+ server.

Prerequisites to Running nisrestore

In order to use nisrestore the target machine that will be receiving the NIS+ data from nisrestore must have already been set up as an NIS+ server. (See Chapter 4, Configuring NIS+ With Scripts for a detailed description of setting up NIS+ servers.) This means that:

  • The machine must have already been initialized as an NIS+ client.

  • If the machine will be running in NIS-compatibility mode and support DNS forwarding, it must have a properly configured /etc/resolv.conf file.

  • If you are using nisrestore on a server while other servers in the namespace are up and running, nisrestore will verify with those other servers that this server is configured to serve the backed up NIS+ objects that you are restoring to it. If no other servers are up and running in your namespace, then you must run nisrestore with the -f option. In other words, if there are other servers that nisrestore can check with, you do not need to use the -f option. If no other servers are available, for example if you are restoring a single master server and there are no functioning replica servers, then you must use the -f option.


Caution - In addition to the three pre-requisites listed above, the rpc.nisd daemon must not be running on the machine. If necessary, you must kill rpc.nisd before running nisrestore.


nisrestore Syntax

The nisrestore command uses the following syntax:

nisrestore [-fv][-a][-t] backupdir [directory_objects]

Where:

  • Backupdir is the directory containing the backup files to be used to restore the NIS+ objects. For example, /var/master1_bakup.

  • Directory_objects are the NIS+ directory objects that you want to restore. For example, org_dir.doc.com. Multiple NIS+ directory objects can be listed separated by spaces. (If you run nisrestore with the -a option, you do not specify specific directory objects.)

The nisrestore command takes the following options:

Table 21-2 Options for the nisbackup Command

Option

Purpose

-a

All. Restores all of the NIS+ directory objects contained in the backup directory.

-f

Forces the restoration without validating that the server is listed in the directory object's serving list. This option must be used when restoring a root master server or if you get an "unable to lookup object" type of error.

-v

Verbose mode. This mode provides additional information

-t

This option lists all of the NIS+ directory objects stored in the backup directory. No restoration of objects takes place.

Using nisrestore

To restore NIS+ data from NIS+ backup files, use the nisrestore command.

For example, to restore the org_dir.doc.com. directory object on the replica1 server, you would log in as root on replica1, make sure that the prerequisites described in "Prerequisites to Running nisrestore" have been met and then run nisrestore as shown below:

replica1# nisrestore /var/master1_bakup org_dir.doc.com.

The following points apply to nisrestore:

  • Damaged namespace. To restore a damaged or corrupted NIS+ namespace, the nisrestore command must be run on all of the servers for the NIS+ directory objects you are restoring.

  • Lookup error. If you get an error message telling you that nisrestore cannot verify or look up needed data, then you must use the -f option.

    For example, to reload NIS+ data on a root master server named master1, you would enter:

master1# nisrestore -f -a /var/master1_bakup
  • Directory names. When specifying the NIS+ directory objects to be restored, you can use full or partially qualified directory names.

Using Backup/Restore to Set Up Replicas

The NIS+ backup and restore features can be used to quickly down load NIS+ data on to a new replica server. For large namespaces this is much faster than nisping to obtain data from the master server.

To use nisbackup and nisrestore to set up a new replica, perform the following:

  1. Run nisserver on the master to create the new replica.

  2. Kill rpc.nisd on the new replica server.

    This interrupts the automatic transfer for namespace data from the master to the replica using the nisping command.

  3. Run nisbackup on the master server.

  4. Run nisrestore on the new replica to down load the NIS+ data.

  5. Restart rpc.nisd on the new replica.

 
 
 
  Previous   Contents   Next