Sun Microsystems, Inc.
spacerspacer
spacer www.sun.com docs.sun.com |
spacer
black dot
 
 
20.  Server-Use Customization Optimizing Server-Use--Overview Server and Client Names  Previous   Contents   Next 
   
 

Server Preferences

To specify a server preference for:

  • Individual client machine, use the -L option to create a local client_info file for the machine you are running the nisprefadm on. Use the -G -C machine options to create machine-specific preferences in the global client_info table.

  • All machines on a subnet, use the -G -C subnetnumber option.

  • All machines in the current domain that do not have machine-specific or subnet-specific preferences, use the -G option.

When Server Preferences Take Effect

Changes you make to a machine or subnet's server preferences normally do not take effect on a given machine until that machine updates it nis_cachemgr data. When the nis_cachemgr of a machine updates its server-use information depends on whether the machine is obtaining its server preferences from a global client_info table or a local /var/nis/client_info file (see "Global Table or Local File").

  • Global table. The cache managers of machines obtaining their server preferences from global tables update their server preferences whenever the machine is booted or whenever the Time-to-live (TTL) value expires for the client_info table. By default, this TTL value is 12 hours, but you can change that as described in "Changing the Time-to-Live of an Object".

  • Local file. The cache managers of machines obtaining their server preferences from local files update their server preferences every 12 hours or whenever you run nisprefadm to change a server preference. (Rebooting the machine does not update the cache manager's server preference information.)

However, you can force server preference changes to take effect immediately by running nisprefadm with the -F option. The -F option forces nis_cachemgr to immediately update its information. See "How to Immediately Implement Preference Changes" for details.

Using the nisprefadm Command

The following sections describe how to use the nisprefadm command to set, modify, and delete server preferences.

The nisprefadm command is used to specify the servers that clients are to prefer.

The nisprefadm command has the following syntax:

nisprefadm -a|-m|-r|-u|-x|-l -L|-G [-o type] \
 [-d domain] \
 [-C machine] \
 servers
nisprefadm -F

Table 20-1 nisprefadm Command Options

Option

Description

-G

Create a global client_info table stored in the domain's org_dir directory. In other words, create a global preferred server list. This option must be used with either -C subnet to specify preferences for all the machines on a given subnet, or -C machine to specify preferences for an individual machine.

-L

Create a local client_info file stored in the local machine's /var/nis directory. In other words, create a preferred server list that applies only to the machine you are running the command on.

-o type

Specify an option. The valid options are: pref_type=all, which specifies that clients can use non-preferred servers if no preferred servers can be contacted, and pref_type=pref_only, which specifies that clients may only use the designated preferred servers.

-d domain

Create a global preferred server client_info table for the specified domain or subdomain.

-C subnet

The number of a subnet to which the preferences will apply.

-C machine

The name of a client machine.

servers

One or more NIS+ servers. These are the servers that are to be preferred.

-a

Add the specified servers to the server list.

-m

Modify the server list. For example, you can use the -m option to change the preference number given to one or more servers.

-r

Remove the specified servers from the server list.

-u

Clear the server list, and then add the specified servers. (In other words, replace the current server list with a new list of preferred servers.)

-x

Remove the server list completely.

-l

List (display) the current preferred server information.

-F

Force changes to a preferred server list to take effect immediately.


Note - The -C machine option should not be used with the -L (local) flag because it has no effect. For example, suppose you are running nisprefadm on the altair machine. You use the -L flag to specify that the preferences you are specifying be written into altair's local client_info file. You also use a -C vega option to specify that the preferences you are creating be applied to the vega machine. The nisprefadmcommand then write your preferences for vega into altair's file. But vega will never see them because vega will always get its server preferences from either its own local client_info file or the domain's global client_info table. Thus, it only makes sense to use the -C option when running nisprefadm with the -G (global) flag.


Viewing Current Server Preferences

To view current server preferences, run nisprefadm with the -l option.

How to View Preferences for a Machine

  • Run nisprefadm with the -L and -l options on the machine.

sirius# nisprefadm -L -l

This displays any server preferences defined in the machine's local /var/nis/client_info file. If there is no local file, no information is displayed and you are returned to your shell prompt.

How to View Global Preferences for Single Machine

  • Run nisprefadm with the -l, -G and -C machinename options.

sirius# nisprefadm -G -l -C machinename

Where machinename is the IP address (number) of the machine.

This displays the preferences set in the domain's global client_info table for that machine.

How to View Global Preferences for a Subnet

  • Run nisprefadm with the -l, -G and -C subnet options.

sirius# nisprefadm -G -l -C subnet

Where subnet is the IP address (number) of the subnet.

This displays the preferences set in the domain's global client_info table for that machine.

How to Specify Preference Rank Numbers

By default, all servers listed after the -a option are given a preference number of zero. To specify a different preference number, enclose the number in parentheses immediately after the server name like this: -a name(n). Where name is the name of the server and n is the preference number.

For example, assign the replica2 server a preference number of 3:

# nisprefadm -G -a replica2(3)

Note - With some shells you may have to enclose the element in quotes like this: "name(n)".


See "Preference Rank Numbers" for background information on the server preference rank numbers.

Specifying Global Server Preferences

You can set global server preferences for a local or remote domain. Preferences may be set for individual machines and all the machines on a subnet.

The procedures in this section describe how to specify server preferences in a global client_info table residing on the NIS+ domain's master server. Once the table exists on the master server, NIS+ replicates it on to any existing replica servers for the domain.

To assign server preference numbers, run nisprefadm with either the:

  • -a option to add new or additional preferred servers.

  • -u option to delete existing server preferences and create new ones.

 
 
 
  Previous   Contents   Next