This procedure describes how to use the scrgadm(1M) command to register and configure Sun Cluster HA for NFS.
Other options also enable you to register and configure the data service. See “Tools for Data Service Resource Administration” in Sun Cluster 3.1 Data Service Planning and Administration Guide for details about these options.
Before you register and configure Sun Cluster HA for NFS, run the following command to verify that the Sun Cluster HA for NFS package, SUNWscnfs, is 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.
Become superuser on a cluster member.
Verify that all of the cluster nodes are online.
# scstat -n |
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 |
Create a failover resource group to contain the NFS resources.
# scrgadm -a -g resource-group -y Pathprefix=/global/admin-dir [-h nodelist] |
Specifies that you are adding a new configuration.
Specifies the failover resource group.
Specifies a directory on a cluster file system that Sun Cluster HA for NFS uses to maintain administrative and status information.
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.
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/inet/hosts file.
Configure name service mapping in the /etc/nsswitch.conf file on the cluster nodes to first check the local files before trying to access NIS or NIS+ for rpc lookups.
Doing so prevents timing-related errors for rpc lookups during periods of public network or nameservice unavailability.
Modify the hosts entry in /etc/nsswitch.conf so that upon resolving a name locally the host does not first contact NIS/DNS, but instead immediately returns a successful status.
Doing this enables HA-NFS to failover correctly in the presence of public network failures.
# hosts: cluster files [SUCCESS=return] nis # rpc: files nis |
(Optional) Customize the nfsd or lockd startup options.
To customize nfsd options, on each cluster node open the /etc/init.d/nfs.server file, find the command line starting with /usr/lib/nfs/nfsd, and add any additional arguments desired.
To customize lockd startup options, on each cluster node open the /etc/init.d/nfs.client file, find the command line starting with /usr/lib/nfs/lockd, and add any command line arguments desired.
The command lines must remain limited to a single line. Breaking the command line into multiple lines is not supported. The additional arguments must be valid options documented in man pages nfsd(1M) and lockd(1M).
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] |
Specifies that you are adding a new configuration.
Specifies the resource group that is to hold the logical hostname resources.
Specifies the logical hostname resource to be added.
Specifies an optional, comma-separated list that identifies the IP Networking Multipathing groups that are on each node. Each element in netiflist must be in the form of netif@node. netif can be given as an IP Networking Multipathing group name, such as sc_ipmp0. The node can be identified by the node name or node ID, such as sc_ipmp0@1 or sc_ipmp@phys-schost-1.
Sun Cluster does not currently support using the adapter name for netif.
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 |
Create a dfstab.resource file in the SUNW.nfs directory that you created in Step 10, and set up share options.
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.
Choose a resource name suffix to identify the NFS resource that you plan to create (in Step 13). 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.
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 |
Identifies the file system type as nfs.
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.
Describes the file system to add.
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)
Register the NFS resource type.
# scrgadm -a -t resource-type |
Adds the specified resource type. For Sun Cluster HA for NFS, the resource type is SUNW.nfs.
Create the NFS resource in the failover resource group.
# scrgadm -a -j resource -g resource-group -t resource-type |
Specifies that you are adding a configuration.
Specifies the name of the resource to add, which you defined in Step 11. This name can be your choice but must be unique within the cluster.
Specifies the name of a previously created resource group to which this resource is to be added.
Specifies the name of the resource type to which this resource belongs. This name must be the name of a registered resource type.
Run the scswitch(1M) command to perform the following tasks.
Enable the resource and the resource fault monitor.
Manage the resource group.
Switch the resource group into the ONLINE state.
# scswitch -Z -g resource-group |
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.) # sc rgadm -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 |
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.
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 of the physical hosts or netgroups that are associated with all of the 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 access and write access to all of the Sun Cluster hostnames to enable the NFS fault probes to do a complete job.
Before you change share options, read the share_nfs(1M) man page to understand which combinations of options are legal.
Become superuser on a cluster node.
Turn off fault monitoring on the NFS resource.
# scswitch -n -M -j resource |
Disables the resource fault monitor
Test the new share options.
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 |
Identifies the file system type as NFS.
Specifies an option. You might use rw, which grants read-write access to all of the clients.
Describes the file system to add.
Identifies the file system to share.
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.
Edit the dfstab.resource file with the new share options.
To remove a path from the dfstab.resource file, perform the following steps in order.
Execute the unshare(1M) command.
From the dfstab.resource file, delete the share command for the path that you want to remove.
# unshare [-F nfs] [-o specific_options] pathname # vi dfstab.resource |
Identifies the file system type as NFS.
Specifies the options that are specific to NFS file systems.
Identifies the file system that is made unavailable.
To add a path or change an existing path in the dfstab.resource file, verify that the mount point is valid, then edit the dfstab.resource file.
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.
Enable fault monitoring on the NFS resource.
# scswitch -e -M -j resource |
The time that Sun Cluster HA for NFS methods require 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.
As a general guideline, allocate 10 seconds toward the method timeouts for each path that is shared. 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, multiply the number of paths by 10 to compute the recommended timeout. For example, if the dfstab.resource file contains 50 shared paths, the recommended timeout is 500 seconds.
Update the following method timeouts if the number of shared paths is greater than 30.
Prenet_start_timeout | Postnet_stop_timeout | Monitor_Start_timeout |
Start_timeout | Validate_timeout | Monitor_Stop_timeout |
Stop_timeout | Update_timeout | Monitor_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 |
The SUNW.HAStoragePlus resource type was introduced in Sun Cluster 3.0 5/02. This new resource type performs the same functions as SUNW.HAStorage, and synchronizes actions between HA storage and Sun Cluster HA for NFS. SUNW.HAStoragePlus also has an additional feature to make a local file system highly available. Sun Cluster HA for NFS is both failover and disk-intensive, and therefore, you should set up the SUNW.HAStoragePlus resource type.
See the SUNW.HAStoragePlus(5) man page and “Relationship Between Resource Groups and Disk Device Groups” in Sun Cluster 3.1 Data Service Planning and Administration Guide for background information. See “Synchronizing the Startups Between Resource Groups and Disk Device Groups” in Sun Cluster 3.1 Data Service Planning and Administration Guide for the procedure. (If you are using a Sun Cluster 3.0 version prior to 5/02, you must set up SUNW.HAStorage instead of SUNW.HAStoragePlus. See “Synchronizing the Startups Between Resource Groups and Disk Device Groups” in Sun Cluster 3.1 Data Service Planning and Administration Guide for the procedure.)