Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
Managing Serviceguard NFS for Linux > Chapter 2 Installing and Configuring Serviceguard NFS for Linux

Copying the Template Files

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Index

If you will run only one Serviceguard NFS package in your Serviceguard cluster, technically you do not have to copy the template files. Though, it is recommended that you keep your template file in its original form for future use. If you will run multiple Serviceguard NFS packages, each package must have its own package directory, package configuration file and control scripts.

For each Serviceguard NFS package you plan to run, make a copy of all the package files including the package configuration file (pkg.conf), package control script (pkg.cntl), toolkit interface script (toolkit.sh), NFS Control Script (hanfs.sh), NFS configuration file (hanfs.conf), NFS monitor script (nfs.mon) and NFS file lock migration synchronization script (nfs.flm). You can rename the package control script with a package specific identification, such as pkg01.conf and pkg01.cntl.

NOTE: pkg.cntl, toolkit.sh , hanfs.conf, nfs.mon, nfs.flm and hanfs.sh should be in the same directory. Do not rename hanfs.conf, hanfs.sh,toolkit.sh, nfs.flm,nfs.1, nfs, tkit_module.sh, tkit_gen.sh, lock_migration.sh and nfs.mon. These file names are hard coded in the control scripts.

Before Creating an Serviceguard NFS Package

Before creating a Serviceguard NFS package, perform the following tasks:

NOTE: The following procedures assume your environment is Red Hat. If your environment is SLES, replace all occurrences of "/usr/local" with /opt.
  1. Select the NFS Server package during Red Hat Linux installation and verify that the NFS is properly installed.

    After Red Hat installation is complete, check for the NFS utility to verify NFS installation:

    • Verify the NFS utility, run the command:

      # rpm –qa | grep nfs

      If the output contains nfs-utils-<release_version> , the utility is installed.

  2. Set up your Serviceguard cluster according to the instructions in the Managing HP Serviceguard for Linux user’s guide.

  3. Configure the disk hardware for high availability. Data disks associated with Serviceguard NFS must be external disks. All the nodes that support the Serviceguard NFS package must have access to the external disks. For most disks this means they must be attached to a shared bus that is connected to all nodes which support the package. The disk on which NFS volume is configured can be either a single lun or a split site RAID 1 array, which provides a level of disaster tolerance to the NFS volume. This can be achieved by setting up a Serviceguard Extended Distance Cluster which uses the linux software RAID as the basic building block. For information on setting up the Extended Distance Cluster, see the HP Serviceguard Extended Distance Cluster for Linux Deployment Guide.

  4. Create a directory for each NFS package. For example:

    /usr/local/cmcluster/nfs1
  5. The names of the volume groups must be unique within the cluster, and the major and minor numbers associated with the volume groups must be the same on all nodes. In addition, the mounting points and exported file system names must be the same on all nodes.

    The preceding requirements exist because NFS uses the major number, minor number, inode number, and exported directory as part of a file handle to uniquely identify each NFS file. If differences exist between the primary and adoptive nodes, the client’s file handle would no longer point to the correct file location after movement of the package to a different node.

  6. Use LVM commands to set up volume groups, logical volumes, and file systems as needed for the data that will be exported to clients. Refer to the Managing HP Serviceguard for Linux manual.

  7. Make sure the user IDs and group IDs of those who access the Serviceguard NFS file system are the same on all nodes that can run the package.

    Make sure the user IDs and group IDs in the /etc/passwd and /etc/group files are the same on the primary node and all adoptive nodes, or use NIS to manage the passwd and group databases.

  8. Create an entry for the name of the package in the DNS or NIS name resolution files, or in /etc/hosts, so that users will mount the exported file systems from the correct node. This entry maps the package name to the package’s relocatable IP address.

  9. Decide whether to place executables locally on each client or on the NFS server. There are a number of trade-offs to be aware of regarding the location of executables with Serviceguard NFS.

    The advantages of keeping executables local to each client are as follows:

    • No failover time. If the executables are local to the client, there is no delay if the NFS server fails.

    • Faster access to the executables than accessing them through the network.

    The advantage of putting the executables on the NFS server is as follows:

    • Ease of management. If the executables are located in one centralized location, the administrator must update only one copy when changes are made.

Configuring a Legacy Serviceguard NFS Package

To configure a Legacy Serviceguard NFS package, complete the following tasks, described in this section:

NOTE: Repeat the configuration process for each NFS package.

Editing the Package Configuration File (pkg.conf)

The following steps describe the required modifications to the Package Configuration File. Make one Package Configuration file for each package.

  1. Except for the variables listed below, use the default values for the variables in the package configuration file, or change them as needed.

    For instructions on modifying the default values, see the Managing HP Serviceguard for Linux manual, or read the comments in the package configuration file.

  2. Set the PACKAGE_NAME variable. For example:

    PACKAGE_NAME pkg01

    Each package must have a unique name.

  3. Create a NODE_NAME variable for each node that will run the package. The first NODE_NAME should specify the primary node. All the NODE_NAME variables following the primary node should specify the adoptive nodes, in the order in which they will be tried. For example:

    NODE_NAME thyme 
    NODE_NAME basil
    NODE_NAME sage
  4. Set the RUN_SCRIPT and HALT_SCRIPT variables to the full path name of the control script. You do not have to specify a timeout for either script. For example:

    RUN_SCRIPT /usr/local/cmcluster/pkg01/pkg01.cntl
    RUN_SCRIPT_TIMEOUT NO_TIMEOUT
    HALT_SCRIPT /usr/local/cmcluster/pkg01/pkg01.cntl
    HALT_SCRIPT_TIMEOUT NO_TIMEOUT
  5. If you want to run the NFS monitor script, set the SERVICE_NAME variable. For example:

    SERVICE_NAME nfs1.monitor

    Each package must have a unique service name. The SERVICE_NAME variable in the package configuration file must match the SERVICE_NAME variable in the package control script.

    If you do not wish to run the NFS monitor script, comment out the SERVICE_NAME variable. For example:

    SERVICE_NAME nfs1.monitor

    If your NFS package configuration file specifies AUTO_RUN as YES, the package switches to the next adoptive node in the event of a node or package failure. The NFS monitor script causes the package to fail over if any of the monitored NFS services fail.

  6. Set the SUBNET variable to the subnet that is monitored for the package. For example:

    SUBNET 192.100.112.0

Editing the Package Control Scripts (pkg.cntl)

The following steps describe the required modifications to the Package Control Scripts. Make one Package Control Script for each package.

NOTE: The following procedures assume your environment is Red Hat. If your environment is SLES, replace all occurrences of /usr/local with /opt.
  1. Create a separate VG[n] variable for each volume group. For example:

    VG[0]=vg01
    VG[1]=vg02
  2. Create a separate LV[n], FS[n], FS_TYPE[n] and FS_MOUNT_OPT[n]variable for each volume group and file system that will be mounted on the server. For example:

    LV[0]=/dev/vg01/lvol1;FS[0]=/ha_root; FS_TYPE[0]=ext3;FS_MOUNT_OPT[0]=”-o rw”
    LV[1]=/dev/vg01/lvol2;FS[1]=/users/scaf; FS_TYPE[1]=ext3;FS_MOUNT_OPT[1]=”-o rw”
    LV[2]=/dev/vg02/lvol1;FS[2]=/ha_data; FS_TYPE[2]=ext3;FS_MOUNT_OPT[2]=”-o ro”

    This example defines the variable for three NFS mounted file systems, ha_root, users/scaf and ha_data.

  3. Specify the IP address for the package and the address of the subnet to which the IP address belongs. For example:

    IP[0]=192.100.112.10
    SUBNET[0]=192.100.112.0

    The IP address you specify is the relocatable IP address for the package. NFS clients that mount the file systems in the package will use this IP address to identify the server. You should configure a name for this address in the DNS or NIS database, or in the /etc/hosts file.

  4. Specify that this package uses the high availability NFS server by uncommenting the HA_APP_SERVER variable. Uncomment the following line:

    HA_APP_SERVER=”pre-IP”
  5. If two packages have the same adoptive node, and you want to prevent a shared adoptive node from adopting both packages at once, specify the cmmodpkg command with the package control option (-d) in the function customer_defined_run_cmds. For example:

    function customer_defined_run_cmds
    {
        cmmodpkg -d -n ‘hostname‘ pkg02 &
    }

    This package control function can prevent an adoptive node from becoming overloaded when multiple packages fail over. If an adoptive node becomes overloaded, it can fail.

    In this example, if a host is an adoptive node for both pkg01 and pkg02, the above cmmodpkg -d command, in the control script for pkg01, would prevent the host that is running pkg01 from adopting pkg02. If pkg02 fails, it will failover to another adoptive node (if configured) where pkg01 is not running.

    Add a similar line in the control script for pkg02 to prevent the host that is running pkg02 from adopting pkg01.

    The ampersand (&) causes the cmmodpkg command to run in the background. The cmmodpkg command in the background allows the control script to complete and finish bringing up the package.

    NOTE: There is a small window of time, during which if one package has begun to fail over but the cmmodpkg command has not executed, the other package can fail over and the host will adopt it. In other words, if two packages fail over at approximately the same time, a host may adopt both packages, even though the package control option is specified.

    See “Configuring One Adoptive Node to Support Failover of Multiple Packages” for a sample configuration using the package control option.

  6. Use the default values for the rest of the variables in the control script, or change them as needed. For instructions on modifying the default values, see the Managing HP Serviceguard for Linux manual, or read the comments in the pkg.cntl template file.

Editing the NFS Configuration File (hanfs.conf)

The following steps describe the required modifications to the NFS Configuration file:

NOTE: The following procedures assume your environment is Red Hat. If your environment is SLES, replace all occurrences of "/usr/local" with “/opt”.
  1. Create a separate XFS[n] variable for each NFS directory to be exported. Specify the directory name and any export options. For example:

    XFS[0]=”*:/ha_root”	
    XFS[1]="*:/users/scaf"	
    XFS[2]="-o ro *:/ha_data"

    Do not configure these exported directories in the /etc/exports file. When an NFS server boots up, it attempts to export all file systems in its/etc/exports file. If those file systems are not currently present on the NFS server node, the node cannot boot properly. This happens if the server is an adoptive node for a file system, and the file system is available on the server only after failover of the primary node.

  2. If you want to start and monitor rpc.quotad daemon, set QUOTA_MON to YES. For example:

    QUOTA_MON=YES

    If you do not want to start and monitor rpc.quotad daemon, set QUOTA_MON to NO. For example:

    QUOTA_MON=NO

Configuring Lock Migration Feature

The following steps need to be completed to use of the lock migration feature:

  1. In the package configuration file, set the SERVICE_FAIL_FAST_ENABLED to “YES” for the NFS monitoring service. Example:

    SERVICE_NAME nfs1.monitor	
    SERVICE_FAIL_FAST_ENABLED YES
    SERVICE_HALT_TIMEOUT    300
    NOTE: In Red Hat, there are times when sending SIGKILL to the kernel ‘lockd’ thread might not release all the file locks and cause the failure of the unmounting of filesystem. To force unmount of the filesystem, the machine has to be rebooted. In such cases, it is recommended to set SERVICE_FAIL_FAST_ENABLED to “YES” which reboots the machine upon service failure.

    In SLES, the SM directory does not consistently update with the client entries. This is due to the client entry being made for the first time only after the system has booted. After a fail back of the package, the NFS fails to create SM directory entries. After a fail back, if the client attempts to reclaim his locks, fresh entries for the clients will not be made in the /var/lib/nfs/sm directory of the server. For SLES, it is mandatory to set SERVICE_FAIL_FAST_ENABLED to “YES”, so the server reboots in order to have lock migration feature work consistently.

    If you halt the package manually on any node configured for an NFS package, you must reboot the machine before the package is run again on the same node.

  2. In the Package Control Script, edit the customer_defined_run_cmds function to execute the toolkit.sh script for file lock migration. In the example below, the following line was added, $HA_APP_SCRIPT lock_migration:<Package IP>.

    NOTE: HA_APP_SCRIPT is initialized to the toolkit.sh path in the package control script.

    Example:

    function customer_defined_run_cmds        
    {		
    $HA_APP_SCRIPT lock_migration:${IP[0]}		
    test_return 51
    }

    NOTE: The argument to be passed to the HA_APP_SCRIPT for lock migration should contain the same name or IP address used by the clients while mounting the exported file system.

    Example: If client mounts the NFS file system using the package name, specify the same in customer_defined_run_cmds as shown below:

    function customer_defined_run_cmds        
    {		
    $HA_APP_SCRIPT lock_migration:
    <package name>		
    test_return 51
    }

    NOTE: A Serviceguard package can support multiple re-locatable IP addresses associated with it. However, if lock migration feature is enabled then only one IP is allowed to be specified in the NFS package control script since the NFS limits server reboot/failover notification to be sent using only a single IP. In the package control script, only one IP/Subnet address pair is allowed to be specified under IP_ADDRESS section.
  3. Configure the following variables in hanfs.conf:

    1. LOCK_MIGRATION:

      To enable File Lock Migration, set the LOCK_MIGRATION variable to “YES”. By default the variable is set to “NO”.

      An example for this parameter is as follows: LOCK_MIGRATION=”YES”

    2. NFS_FLM_HOLDING_DIR:

      Name of a unique directory created in one of the shared volumes associated with this package. This directory holds copies of the /var/lib/nfs/sm files on SLES and /var/lib/nfs/statd/sm files on Red Hat for this package. You must create this directory in one of the shared volumes associated with this package so that it can migrate with the package (from the primary server to the adoptive server).

      You must dedicate this directory for holding SM entries only. In addition, you must not add any files as this directory is maintained by the toolkit. This directory should not have other files or subdirectories when starting the cluster. All files in this directory are deleted after a failover.

      An example for this parameter is as follows: NFS_FLM_HOLDING_DIR=/ha_root/sm

      The above directory should be present in one of the file systems specified in the package control script.

    3. PROPAGATE_INTERVAL:

      Number of seconds between the attempts of the script to copy files from the /var/lib/nfs/sm directory on SLES and /var/lib/nfs/statd/sm on Red Hat into the holding directory, specified by NFS_FLM_HOLDING_DIR. The default value of this parameter is five seconds.

      An example for this parameter is as follows:

      PROPAGATE_INTERVAL=5

      NOTE: The NFS client may not receive a crash notification if it sends an initial lock request to the NFS server and during the interim, the NFS package failsover to an adoptive node before the FLM script copies the /var/lib/nfs/statd/sm entry on Red Hat and /var/lib/nfs/sm entry on SLES for this client to the package holding directory. Hence the client may not reclaim the lock once the NFS package fails over to the adoptive node.

      The probability of this occurring within the default time interval between copies is extremely low as the SM file copy interval is very short (by default, five seconds). You can reduce the probability further by configuring the time interval to a value lower than the default.

    4. NFS_FLM_MONITOR:

      To monitor the file lock migration script (nfs.flm) by the NFS monitor script (nfs.mon), set the NFS_FLM_MONITOR variable to “YES”. The default value is NO. Setting this parameter to “YES” ensures that the file lock state files are being copied into holding directory successfully.

    5. NFS_FLM_RESTART:

      Number of times the monitoring script should attempt to restart the file lock migration script (nfs.flm) if it fails. The default value is 4.

      NOTE: To use the lock migration feature, the user has to do all the configurations specified above and also consider all the limitations of the lock migration feature mentioned in the section on See section,“Limitations of the NFS File Lock Migration Feature”.

Creating the Serviceguard Binary Configuration File

The following step must be executed to create a Serviceguard Binary Configuration file:

  1. Use the cmapplyconf command to verify the content of your cluster and package configuration and copy the binary configuration file to all the nodes in the cluster.

    In the following example, the cluster configuration file is /usr/local/cmcluster/cluster.conf. On your system, use the names of your own cluster configuration and package configuration files.

    # cmapplyconf -v -C /usr/local/cmcluster/cluster.conf -P \ /usr/local/cmcluster/pkg01/pkg01.conf

Housekeeping Suggestions

After the NFS toolkit is installed, the shell scripts are located in /usr/local/cmcluster/nfstoolkit and the binary file is located in /usr/bin on your Linux platforms. It is recommended that you set up directories to keep your various package and script files grouped for organization. Set up one directory for each package and keep the associated configuration and monitoring scripts in that directory.

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© Hewlett-Packard Development Company, L.P.