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

Consolidated LAMP configuration
In this configuration, since Apache and MySQL will run as a single Serviceguard for
Linux package, only a single package configuration file and a single package control
script need to be created. This package control script would make use of the toolkit
scripts of both Apache and MySQL to start, monitor, and stop the respective services.
To configure Apache and MySQL as a consolidated LAMP package, follow all
instructions in the Apache and MySQL toolkit README files except for the instructions
which describe the creation and configuration of the package configuration file and the
package control script for both Apache and MySQL (Section “C” in the Apache toolkit
README and Section “D” in the MySQL toolkit README). These instructions in the
Apache and MySQL README’s are replaced by the procedure for configuring Apache
and MySQL as part of the same Serviceguard for Linux package as explained below.
The following procedures provide an EXAMPLE for configuring a Serviceguard for Linux
LAMP single package. In this example the package is named “lamp_single” and has a
service each for Apache and MySQL. The Apache service is named “http.monitor” and
the MySQL service is called “mysql.monitor”. The package configuration file and the
package control script are named “lamp_single_pkg.config” and “lamp_single_pkg.cntl”
respectively.
In the EXAMPLE, the Apache Document Root is on a shared file system and the Server
Root is configured locally. For MySQL however, both configuration files and the
database are on a shared file system.
The Apache Document Root is on a file system “/Apache” directory, which resides on the
logical volume “lvol0” in the “/dev/vg01” volume group on shared storage. The MySQL
configuration and database files are on a file system named “/MySQL_1” on “lvol0” in
the “/dev/vg02” volume group.
The volume structure chosen above is for the set of instructions described in this section.
The user may choose another structure which is relevant to his setup. Please refer to the
toolkit README’s for a description of the possible volume structure configurations.
The first step before starting the package configuration is to create a directory for both
Apache and MySQL. (E.g. /usr/local/cmcluster/conf/http_pkg;
/usr/local/cmcluster/conf/mysql_pkg) and copy all the Apache and MySQl toolkit
scripts from “/usr/local/cmcluster/apachetoolkit” and
“/usr/local/cmcluster/mysqltoolkit” to the respective Apache and MySQL directories
which were just created.
NOTE: the directory structures shown in this white paper are for RedHat installations.
For SuSE installations replace “/usr/local” with “/opt”. Check the documentation for the
toolkits, Apache, and MySQL to determine any other directory differences.
The package configuration file (e.g. lamp_single_pkg.config) and the package control
script (e.g. lamp_single_pkg.cntl) templates must be created in the Apache package
directory (the reason for keeping the files in the Apache package directory is explained
later in the document).
To create the package configuration file and the package control script file:
# cmmakepkg –p lamp_single_pkg.config
# cmmakepkg -s lamp_single_pkg.cntl
6