Sun Cluster 3.0 12/01 Data Services Installation and Configuration Guide

How to Set Up and Configure Sun Cluster HA for NFS

  1. Become superuser on a cluster member.

  2. Verify that all of the cluster nodes are online.


    # scstat -n
    
  3. Create the Pathprefix directory.

    The Pathprefix directory exists on the cluster file system that Sun Cluster HA for NFS uses to maintain administrative and status information.

    You can specify any directory for this purpose. However, you must manually create an admin-dir directory for each resource group that you create. For example, create the directory /global/nfs.


    # mkdir -p /global/admin-dir
    
  4. Create a failover resource group to contain the NFS resources.


    # scrgadm -a -g resource-group -y Pathprefix=/global/admin-dir [-h nodelist]
    -a

    Specifies that you are adding a new configuration.

    -g resource-group

    Specifies the failover resource group.

    -y Pathprefix=path

    Specifies a directory on a cluster file system that Sun Cluster HA for NFS uses to maintain administrative and status information.

    [-h nodelist]

    Specifies an optional, comma-separated list of physical node names or IDs that identify potential masters. The order here determines the order in which the Resource Group Manager (RGM) considers primary nodes during failover.

  5. Verify that you have added all of your logical hostname resources to the name service database.

    To avoid any failures because of name service lookup, verify that all of the logical hostnames are present in the server's and client's /etc/hosts file.

  6. 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.

  7. Add the desired logical hostname resources into the failover resource group.

    You must set up a logical hostname resource with this step. The logical hostname that you use with Sun Cluster HA for NFS cannot be a SharedAddress resource type.


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

    Specifies that you are adding a new configuration.

    -L -g resource-group

    Specifies the resource group that is to hold the logical hostname resources.

    -l logical-hostname, ...

    Specifies the logical hostname resource to be added.

    -n netiflist

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

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

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


    # mkdir Pathprefix/SUNW.nfs
  9. Create a dfstab.resource file in the SUNW.nfs directory that you created in Step 8, and set up share options.

    1. Create the Pathprefix/SUNW.nfs/dfstab.resource file.

      This file contains a set of share commands with the shared path names. The shared paths should be subdirectories on a cluster file system.


      Note -

      Choose a resource name suffix to identify the NFS resource that you plan to create (in Step 11). A good resource name refers 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.


    2. 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

      Grants read-write access to all of the clients. See the share(1M) man page for a list of options. Set the rw option for Sun Cluster.

      -d description

      Describes the file system to add.

      pathname

      Identifies the file system to share.

    When you set up your share options, consider the following points.

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

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

      Grant read and write access to all of 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.

    • If you specify a client list in the share command, include all of the physical hostnames and logical hostnames that are associated with the cluster, as well as the hostnames for all of the clients on all of the 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 of those cluster hostnames to the appropriate net group.

    The share -o rw command grants write access to all of the clients, including the hostnames that the Sun Cluster software uses. This command 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)

  10. Register the NFS resource type.


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

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

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


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

    Specifies that you are adding a configuration.

    -j resource

    Specifies the name of the resource to add, which you defined in Step 9. 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.

  12. 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 Sun Cluster HA for NFS.


(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.)
# share -F nfs -o rw=engineering -d "home dirs" nfs/SUNW.nfs
 
(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.