Sun Cluster 3.0 U1 Data Services Installation and Configuration Guide

Setting Up and Configuring Sun Cluster HA for NFS

This procedure describes how to use the scrgadm(1M) command to register and configure the Sun Cluster HA for NFS data service.


Note -

Other options also enable you to register and configure the data service. See "Tools for Data-Service Resource Administration" for details about these options.


Before you set up and configure the Sun Cluster HA for NFS data service, run the following command to verify that the Sun Cluster HA for NFS package SUNWscnfs has been installed on the cluster.


# pkginfo -l SUNWscnfs

If the package has not been installed, see "Installing Sun Cluster HA for NFS Packages" for instructions on how to install the package.

How to Set Up and Configure Sun Cluster HA for NFS

  1. Become superuser on a cluster member.

  2. Verify that all nodes in the cluster are up and running.


    # scstat
    
  3. Create a failover resource group to contain the NFS resources.


    Note -

    You must define Pathprefix, which is a directory on a cluster file system that the Sun Cluster HA for NFS data service uses to maintain administrative and status information, for the Sun Cluster HA for NFS resource group. You can specify any directory for this purpose, but you must create the directory on the cluster file system.



    # scrgadm -a -g resource-group -y Pathprefix=/global/admin-dir
    

    Note -

    The admin-dir directory must be on a cluster file system. You must manually create this directory.


    -a -g resource-group

    Adds the named failover resource group.

    -y Pathprefix=path

    Specifies a directory on a cluster file system for Sun Cluster HA for NFS administration files to use. For example, /global/nfs. Pathprefix must be unique for each resource group that you create.

  4. Verify that all logical hostnames that you will use have been added to your name-service database.

    You should have performed this verification during the Sun Cluster installation. See the planning chapter in the Sun Cluster 3.0 U1 Installation Guide for details on this step.


    Note -

    To avoid any failures because of name-service lookup, verify that all logical hostnames are present in the server's and client's /etc/hosts file. Configure name-service mapping in the /etc/nsswitch.conf file on the servers to first check the local files before trying to access NIS or NIS+. Doing so prevents timing-related errors in this area and ensures that ifconfig and statd succeed in resolving logical hostnames.


  5. Add the desired logical-hostname resources into the failover resource group.

    You must set up a LogicalHostname resource with this step. The hostname used with the Sun Cluster HA for NFS data service cannot be a SharedAddress resource.


    # scrgadm -a -L -g resource-group -l logical-hostname, ... [-n netiflist]
    -a -L -g resource-group

    Specifies the failover resource group into which to place the logical-hostname resources.

    -l logical-hostname, ...

    Specifies the network resources (logical hostnames) to be added.

    -n netiflist

    Specifies an optional comma-separated list that identifies the NAFO groups on each node. All the nodes in nodelist of the resource group must be represented in netiflist. If you do not specify this option, scrgadm(1M) attempts to discover a net adapter on the subnet that the hostname list identifies for each node in nodelist.

  6. From any node of the cluster, create a directory structure for the NFS configuration files.

    Create the administrative subdirectory directory below the directory that the Pathprefix property identifies in Step 3, for example, /global/nfs/SUNW.nfs.


    # mkdir Pathprefix/SUNW.nfs
  7. Create a dfstab.resource file in the SUNW.nfs directory created in Step 6, and set up share options.

    For example, create the Pathprefix/SUNW.nfs/dfstab.resource file, which contains a set of share commands with the shared path names. The shared paths should be subdirectories on a cluster file system.

    Choose a resource-name suffix to identify the NFS resource that you plan to create (in Step 9). A good resource name would refer to the task that this resource is expected to perform. For example, a name such as user-nfs-home is a good candidate for an NFS resource that shares user home directories.

    Set up the share options for each path that you have created to be shared. The format of this file is exactly the same as the format that is used in the /etc/dfs/dfstab file.


    share [-F nfs] [-o] specific_options [-d "description"] pathname 
    
    -F nfs

    Identifies the file system type as nfs.

    -o specific_options

    See the share(1M) man page for a list of options. You should set the rw option for Sun Cluster. This command grants read-write access to all clients.

    -d description

    Describes the file system being added.

    pathname

    Identifies the file system being shared.

    The share -o rw command grants write access to all clients, including the hostnames that the Sun Cluster software uses and enables Sun Cluster HA for NFS fault monitoring to operate most efficiently. See the following man pages for details.

    • dfstab(4)

    • share(1M)

    • share_nfs(1M)

    If you specify a client list in the share command, include all physical and logical hostnames that are associated with the cluster, as well as the hostnames for all clients on all public networks to which the cluster is connected.

    If you use net groups in the share command (rather than names of individual hosts), add all those cluster hostnames to the appropriate net group.


    Note -

    Do not grant access to the hostnames on the cluster interconnect.


    Grant read and write access to all the cluster nodes and logical hosts to enable the Sun Cluster HA for NFS monitoring to do a thorough job. However, you can restrict write access to the file system or make the file system entirely read-only. If you do so, Sun Cluster HA for NFS fault monitoring can still perform monitoring without having write access.


    Note -

    When constructing share options, do not use the root option, and do not mix the ro and rw options.


  8. Register the NFS resource type.


    # scrgadm -a -t resource-type
    
    -a -t resource-type

    Adds the specified resource type. For the Sun Cluster HA for NFS data service, the resource type is SUNW.nfs.

  9. Create the NFS resource in the failover resource group.


    # scrgadm -a -j resource -g resource-group -t resource-type
    
    -a

    Adds a resource.

    -j resource

    Specifies the name of the resource to add, which you defined in Step 7. This name can be your choice but must be unique within the cluster.

    -g resource-group

    Specifies the name of a previously created resource group to which this resource is to be added.

    -t resource-type

    Specifies the name of the resource type to which this resource belongs. This name must be the name of a registered resource type.

  10. Run the scswitch(1M) command to perform the following tasks.

    • Enable the resource and the resource monitor.

    • Manage the resource group.

    • Switch the resource group into the online state.


    # scswitch -Z -g resource-group
    

Example - Setting Up and Configuring Sun Cluster HA for NFS

The following example shows how to set up and configure the Sun Cluster HA for NFS data service.


(Create a logical host resource group and specify the path to the administrative files used by NFS (Pathprefix).)
# scrgadm -a -g resource-group-1 -y Pathprefix=/global/nfs
 
(Add logical hostname resources into the logical host resource group.)
# scrgadm -a -L -g resource-group-1 -l schost-1
 
(Make the directory structure contain the Sun Cluster HA for NFS configuration files.)
# mkdir -p /global/nfs/SUNW.nfs
 
(Create the dfstab.resource file under the nfs/SUNW.nfs directory and set share options.)
 
(Register the NFS Resource Type.)
# scrgadm -a -t SUNW.nfs
 
(Create the NFS resource in the resource group.)
# scrgadm -a -j r-nfs -g resource-group-1 -t SUNW.nfs
 
(Enable the resources and their monitors, manage the resource group, and switch the resource group into online state.)
# scswitch -Z -g resource-group-1

Where to Go From Here

See "How to Change Share Options on an NFS File System" to set share options for your NFS file systems. See "Configuring Sun Cluster HA for NFS Extension Properties" to review or set extension properties.

How to Change Share Options on an NFS File System

If you use the rw, rw=, ro, or ro= options to the share -o command, NFS fault monitoring works best if you grant access to all the physical hosts or netgroups associated with all Sun Cluster servers.

If you use netgroups in the share(1M) command, add all of the Sun Cluster hostnames to the appropriate netgroup. Ideally, grant both read and write access to all of the Sun Cluster hostnames to enable the NFS fault probes to do a complete job.


Note -

Before you change share options, read the share_nfs(1M) man page to understand which combinations of options are legal.


  1. Become superuser on a cluster node.

  2. Turn off fault monitoring on the NFS resource.


    # scswitch -n -M -j resource
    
    -M

    Disables the resource monitor.

  3. Execute your proposed new share command.

    Before you edit the dfstab.resource file with new share options, execute the new share command to verify the validity of your combination of options.


    # share -F nfs [-o] specific_options [-d "description"] pathname
    
    -F nfs

    Identifies the file system type as NFS.

    -o specific_options

    Specifies an option. You might use rw, which grants read-write access to all clients.

    -d description

    Describes the file system being added.

    pathname

    Identifies the file system being shared.

    If the new share command fails, immediately execute another share command with the old options. When the new command executes successfully, proceed to Step 4.

  4. Edit the dfstab.resource file with the new share options.

    The format of this file is exactly the same as the format that is used in the /etc/dfs/dfstab file. Each line consists of a share command.

  5. (Optional) If you are removing a path from the dfstab.resource file, execute the unshare(1M) command, then remove the share command for the path from the dfstab.resource file.


    # unshare [-F nfs] [-o rw] pathname
    # vi dfstab.resource
    
    -F nfs

    Identifies the file system type as NFS.

    -o options

    Specifies the options that are specific to NFS file systems.

    pathname

    Identifies the file system being made unavailable.

  6. (Optional) If you are adding a path to or changing an existing path in the dfstab.resource file, verify that the mount point is valid, then perform Step 3 and Step 4.

  7. Enable fault monitoring on the NFS resource.


    # scswitch -e -M -j resource
    

How to Tune Sun Cluster HA for NFS Method Timeouts

The time Sun Cluster HA for NFS methods take to finish depends on the number of paths that the resources share through the dfstab.resource file. The default timeout for these methods is 300 seconds. A simple rule of thumb is to allocate 10 seconds toward the method time-out values for each path shared. Because the default timeouts are designed to handle 30 shared paths, if the number of shared paths is less than 30, do not reduce the timeout.

If the number of shared paths exceeds 30, however, multiply that number by 10 to compute the recommended timeout. For example, if the dfstab.resource file contains 50 shared paths, the recommended timeout is 500 seconds.

Change the following method timeouts.

Prenet_start_timeoutPostnet_stop_timeoutMonitor_Start_timeout
Start_timeoutValidate_timeoutMonitor_Stop_timeout
Stop_timeoutUpdate_timeoutMonitor_Check_timeout

To change method timeouts, use the scrgadm -c option, as in the following example.


% scrgadm -c -j resource -y Prenet_start_timeout=500

How to Configure SUNW.HAStorage Resource Type

The SUNW.HAStorage resource type synchronizes actions between HA storage and the data service. The Sun Cluster HA for NFS data service is disk-intensive, and therefore you should set up the SUNW.HAStorage resource type.

See the SUNW.HAStorage(5) man page and "Relationship Between Resource Groups and Disk Device Groups" for background information. See "How to Set Up SUNW.HAStorage Resource Type for New Resources" for the procedure.