Using HP Serviceguard for Linux to Provide High Availability for LAMP, December 2005

LV[1]="/dev/vg02/lvol0"; FS[1]="/MySQL_1"; FS_TYPE[1]="ext3";
FS_MOUNT_OPT[1]="-o rw"
LV[0] is the logical volume of Apache’s mount point and FS[0] is the mount point for the
shared Apache directory, whereas LV[1] is the logical volume of MySQL’s mount point
and FS[1] is the mount point for the shared MySQL directory.
IP[0]="15.70.191.61"
SUBNET[0]="15.70.191.0"
IP[0] is the virtual IP for the package lamp_single
HA_APP_SERVER="post-IP"
Enabling this variable initiates a call to the toolkit.sh file in the current directory. In this
case it is the Apache toolkit.sh file.
SERVICE_NAME[0]="mysql.monitor"
SERVICE_CMD[0]="/usr/local/cmcluster/conf/mysql_pkg/toolkit.sh monitor"
SERVICE_RESTART[0]="-r 0"
The three variables listed above must be configured in order to invoke the MySQL
monitor script. The corresponding Apache service variables that invoke the Apache
monitor are not defined here but are set in the hahttp.conf file that comes with the toolkit.
Note that the
SERVICE_NAME entry must be the same as the one used in the package
configuration file.
Next, make the changes in the control script that define the customer defined run and
halt commands.
function customer_defined_run_cmds
{
# ADD customer defined run commands.
: # do nothing instruction, because a function must contain some
command.
/usr/local/cmcluster/conf/mysql_pkg/toolkit.sh start
#test_return 51
}
function customer_defined_halt_cmds
{
# ADD customer defined halt commands.
: # do nothing instruction, because a function must contain some
command.
/usr/local/cmcluster/conf/mysql_pkg/toolkit.sh stop
#test_return 52
}
In the customer defined run and halt commands, calls are made to the MySQL toolkit.sh
file and start and stop parameters are passed to it. The MySQL toolkit requires separate
calls to be made to monitor, start and stop the MySQL services. All calls to the Apache
toolkit are made by enabling the HA_APP_SERVER variable which in turn enables the
toolkit calling functions.
Next edit the hahttp.conf and hamysql.conf files residing in the respective toolkit
directories as per the instructions in the respective toolkit README files. These files
contain the environment variables required to run and monitor the respective services.
8