Installation guide
92 Chapter 5:Database Services
in the cluster environment. This will ensure that failover is transparent to database client application
programs and does not require programs to reconnect.
5.3 Setting Up a MySQL Service
A database service can serve highly-available data to a MySQL database application. The application
can then provide network access to database client systems, such as Web servers. If the service fails
over, the application accesses the shared database data through the new cluster system. A network-
accessible database service is usually assigned one IP address, which is failed over along with the
service to maintain transparent access for clients.
An example of a MySQL database service is as follows:
• The MySQL server and the database instance both reside on a file system that is located on a disk
partition on shared storage. This allows the database data and its run-time state information, which
is required for failover, to be accessed by both cluster systems. In the example, the file system is
mounted as /var/mysql, using the shared disk partition /dev/sda1.
• An IP address is associated with the MySQL database to accommodate network access by clients
of the database service. This IP address will automatically be migrated among the cluster members
as the service fails over. In the example below, the IP address is 10.1.16.12.
• The script that is used to start and stop the MySQL database is the standard System V init
script, which has been modified with configuration parameters to match the file system on which
the database is installed.
• By default, a client connection to a MySQL server will time out after eight hours of inactivity.
This connection limit can be modified by setting the wait_timeout variable when you start
mysqld. For example, to set timeouts to 4 hours, start the MySQL daemon as follows:
mysqld -O wait_timeout=14400
To check if a MySQL server has timed out, invoke the mysqladmin version command and
examine the uptime. Invoke the query again to automatically reconnect to the server.
Depending on the Linux distribution, one of the following messages may indicate a MySQL server
timeout:
CR_SERVER_GONE_ERROR
CR_SERVER_LOST
A sample script to start and stop the MySQL database is located in /usr/share/clus-
ter/doc/services/examples/mysql.server, and is shown below:
#!/bin/sh
# Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
# This file is public domain and comes with NO WARRANTY of any kind