Cost-Effective High-Availability Solutions with HP Instant Capacity on HP-UX
Scripts for implementing failover with Serviceguard
While you can implement rights seizure as part of an automatic failover system, you must ensure
resources are seized appropriately and in a manner that will not cause problems when the failures
are corrected. The Instant Capacity software determines that a partition is down based on whether the
ping command is unsuccessful for the partition. However, ping can be unsuccessful even though the
system is functional (for example, if a network connection is interrupted). In this case, rights seizure
might be inappropriate, leaving workloads without the necessary resources.
Note:
These scripts are for illustrative purposes. They provide a starting point for
implementation and assume that all application workloads are under the
control of Serviceguard. The sample scripts should be modified to fit your
specific requirements. In particular, the start-up script uses remsh for a
remote operation, but a more secure implementation would use ssh (secure
shell). Also, the script should be made more robust by checking for errors
and other possible cluster states, and exiting with appropriate return status
values. The scripts are for customer-defined run/halt commands used in the
Serviceguard legacy package format; however, they can easily be
modified to use external_scripts with the Serviceguard modular package
format. These sample scripts are not part of either the iCAP or Serviceguard
products and are not supported by HP.
Scripts for member failover in an nPartition environment
These scripts correspond to the “Example: Automated (Serviceguard) member failover from a partial
outage with nPartitions” sub-section. This example is based on a Serviceguard cluster that includes the
partitions db1 and db2. The failover package is defined to run normally on db1 and with AUTO_RUN
enabled so that failover will occur to db2. There is no standby Group Manager, so no Group
Manager failover. For this example, assume the package workload needs a minimum of six processor
cores to be activated. The gicap_start.sh start-up script is invoked from
customer_defined_run_cmds of the package control script. It will run on the partition where
Serviceguard starts the package (either a normal start-up or a failover start-up) or when the
cmrunpkg command is invoked.
#cat gicap_start.sh
#! /usr/bin/sh
PATH=$PATH:/usr/sbin
HOSTNAME=`/usr/bin/hostname`
case $HOSTNAME in
db1) OTHER_HOST=db2;;
db2) OTHER_HOST=db1;;
esac
# check the OS status of the other node in the cluster
STATUS=`cmviewcl -f line -n $OTHER_HOST | grep ^status= | cut -f 2 -d=`
If [[ $STATUS != “up” ]]
then
41