Nonstop Database, HiRDB Version 9 System Operation Guide

[Contents][Index][Back][Next]

26.2.6 MC/ServiceGuard preparations

We recommend that you read this subsection if you are using MC/ServiceGuard as your cluster software.

To set up an environment for MC/ServiceGuard, see the explanation in this subsection and the documentation for MC/ServiceGuard. For more information about how to set up an MC/ServiceGuard environment, see the documentation for MC/ServiceGuard.

Organization of this subsection
(1) Package
(2) Shell script for starting HiRDB
(3) Shell script for terminating HiRDB
(4) Shell script for generating a dummy process (services monitored by MC/ServiceGuard) (monitor mode only)
(5) Package IP address
(6) Example of a grouped MC/ServiceGuard and HiRDB configuration

(1) Package

The unit that MC/ServiceGuard uses for switching systems is called a package. A package refers to a set of the following resources, which are necessary for applications to run:

Products that group MC/ServiceGuard with HiRDB are usually handled as a single package, which MC/ServiceGuard uses for switching systems. The following figures provide an overview of packaging and the flow of package processing by MC/ServiceGuard.

Figure 26-35 ackage overview

[Figure]

Figure 26-36 Flow of package processing by MC/ServiceGuard

[Figure]

(2) Shell script for starting HiRDB

Create a shell script for starting HiRDB (execute $PDDIR/bin/pdstart). Be sure to execute that shell script when you start the package (during package startup preprocessing). Set up the shell script for starting HiRDB so that the package control script for MC/ServiceGuard executes this shell script. The following figure shows the flow of HiRDB startup processing.

Figure 26-37 HiRDB startup processing flow (MC/ServiceGuard)

[Figure]

(a) Examples of shell scripts for starting HiRDB

The following examples show shell scripts for starting HiRDB.

[Figure] HiRDB single server configuration

 
#!/bin/sh
PDDIR=/HiRDB_S
PDCONFPATH=${PDDIR}/conf
SHLIB_PATH=${PDDIR}/lib
PATH=${PATH}:${PDDIR}/bin
export PDDIR PDCONFPATH SHLIB_PATH PATH
${PDDIR}/bin/pdstart>/dev/null 2>&1
 

[Figure] HiRDB parallel server configuration

 
#!/bin/sh
PDDIR=/HiRDB_P
PDCONFPATH=${PDDIR}/conf
SHLIB_PATH=${PDDIR}/lib
PATH=${PATH}:${PDDIR}/bin
export PDDIR PDCONFPATH SHLIB_PATH PATH
${PDDIR}/bin/pdstart -q>/dev/null 2>&1
 

Note
Modify the PDDIR directory on the second line as appropriate for the environment.
The pdstart -q command starts the units in a HiRDB parallel server configuration when the system switchover facility is used.
(b) When the pdstart command fails and HiRDB does not start

The following are possible causes of a pdstart command failure:

  1. HiRDB is starting.
  2. HiRDB is running.
  3. HiRDB is terminating normally or planned termination is underway.
  4. HiRDB is terminating abnormally.
  5. HiRDB's environment setup is incorrect.

Items 1 to 4 can occur if the package is started before HiRDB has stopped. There is no means to accurately determine when one of these events might happen. In such a case, you can safely ignore the pdstart command error because it does not affect any other operations.

In the case of item 5, HiRDB cannot start because the HiRDB environment setup is incorrect. You must correct the environment setup.

(c) Note

If no system RDAREAs have been created, an instruction to create system RDAREAs (execute the pdinit command) is displayed during HiRDB startup (during execution of the pdstart command). The pdstart command started from MC/ServiceGuard executes in the background, so it cannot respond to this instruction. Therefore, before starting operation of MC/ServiceGuard, execute the pdstart command and make sure that system RDAREAs have been created.

(3) Shell script for terminating HiRDB

Create a shell script for terminating HiRDB (executing $PDDIR/bin/pdstop), and start this shell script when the package stops. To do this, set a shell script that terminates HiRDB inside the package control script of MC/ServiceGuard. The following figure shows the flow of HiRDB termination processing.

Figure 26-38 HiRDB termination processing flow (MC/ServiceGuard)

[Figure]

(a) Examples of shell scripts for terminating HiRDB

The following examples show shell scripts for terminating HiRDB.

[Figure] HiRDB single server configuration

 
#!/bin/sh
PDDIR=/HiRDB_S
PDCONFPATH=${PDDIR}/conf
SHLIB_PATH=${PDDIR}/lib
PATH=${PATH}:${PDDIR}/bin
export PDDIR PDCONFPATH SHLIB_PATH PATH
${PDDIR}/bin/pdstop -f -q>/dev/null 2>&1
 

Note
Specify the pdstop -f -q command to forcibly terminate HiRDB.

[Figure] HiRDB parallel server configuration

 
#!/bin/sh
PDDIR=/HiRDB_P
PDCONFPATH=${PDDIR}/conf
SHLIB_PATH=${PDDIR}/lib
PATH=${PATH}:${PDDIR}/bin
export PDDIR PDCONFPATH SHLIB_PATH PATH
${PDDIR}/bin/pdstop -z -q>/dev/null 2>&1
 

Note
Specify the pdstop -z -q command to forcibly terminate HiRDB.
(b) Notes

(4) Shell script for generating a dummy process (services monitored by MC/ServiceGuard) (monitor mode only)

MC/ServiceGuard monitors services (applications). It executes a service as a sub-process, and when it detects service termination, it determines that a package error has occurred. The only interface between HiRDB and MC/ServiceGuard, except for HiRDB startup and termination processing, is service termination (exit). All HiRDB processes are monitored by pdprcd and are restarted by HiRDB after an abnormal termination. Therefore, there is no need to have MC/ServiceGuard monitor HiRDB processes. The following figure shows the relationship between process startup and monitoring.

Figure 26-39 Relationship between process startup and monitoring (MC/ServiceGuard)

[Figure]

To maintain the status in which HiRDB is running as a package, a dummy service (dummy process) is necessary. This dummy process must satisfy all of the following conditions:

Conditions
  1. The process must be resident.
  2. Because MC/ServiceGuard issues SIGTERM when it issues an instruction to terminate the package, the process must terminate when SIGTERM is received.
  3. There is no need to notify MC/ServiceGuard of HiRDB's abnormal termination.

The following example shows a shell script for generating a dummy process:

 
#!/bin/sh
trap exit SIGTERM
while true
do
    sleep 5
done
exit
 

Explanation
This example is coded in the Bourne shell. sleep executes in an infinite loop until SIGTERM (=15) is received. Other implementation methods are also possible.

Specify this shell script in SERVICE_CMD in the package control script. To start a resident process, use SERVICE RESTART ="-R" in the package control script to specify unlimited startups. Otherwise, unexpected termination will be treated as an abnormal termination of the HiRDB server.

(5) Package IP address

Specify the package's IP address (repositionable IP address) in the package control script.

 
IP[0] = Package-IP-address (repositionable-IP-address)
 

(6) Example of a grouped MC/ServiceGuard and HiRDB configuration

This subsection provides and explains an example of a grouped MC/ServiceGuard and HiRDB configuration. The figure below shows the system configuration. In this case, HiRDB uses a HiRDB single server configuration.

Figure 26-40 Example of a grouped MC/ServiceGuard and HiRDB configuration

[Figure]

(a) Package control scripts

[Figure] Definitions related to system configuration

 
VGCHANGE="vgchange -a e"
VG[0]=vg10
LV[0]=/dev/vg10/lvol11; FS[0]=/hirdb
IP[0]=192.168.30.51
SUBNET[0]=192.168.30.0
 

[Figure] MC/ServiceGuard service registration (definitions for monitoring HiRDB startup and termination)

 
SERVICE_NAME[0]=hirdb
 
#Service = specifies the process to be monitored [required]
#MC/ServiceGuard starts and monitors for process termination.
SERVICE_CMD[0]=/etc/cmcluster/hirdb_pkg/monitor.sh         1
SERVICE_RESTART[0]="-R"
 
#Service startup preprocessing: Start HiRDB here.
function customer_defined_run_cmds
{
/etc/cmcluster/hirdb_pkg/run.sh                            2
test_return 51
}
 
#Service stop preprocessing: Stop HiRDB here.
function customer_defined_halt_cmds
{
/etc/cmcluster/hirdb_pkg/halt.sh                           3
test_return 52
}
 

Explanation
  1. Specifies the shell script for generating a dummy script.
  2. Specifies the shell script for starting HiRDB.
  3. Specifies the shell script for terminating HiRDB.
(b) Shell scripts

[Figure] Shell script for generating a dummy script (monitor.sh)

 
#!/bin/ksh
trap exit SIGTERM
while true
do
   sleep 5
done
exit
 

[Figure] Shell script for starting HiRDB (run.sh)

 
#!/bin/sh
PDDIR=/home/test
PDCONFPATH=${PDDIR}/conf
SHLIB_PATH=${PDDIR}/lib
PATH=${PATH}:${PDDIR}/bin
export PDDIR PDCONFPATH SHLIB_PATH PATH
/home/test/bin/pdstart > /dev/null 2>&1
 

[Figure] Shell script for terminating HiRDB (halt.sh)

 
#!/bin/sh
export PDDIR=/home/test
export PDCONFPATH=${PDDIR}/conf
export SHLIB_PATH=${PDDIR}/lib
export PATH=${PATH}:${PDDIR}/bin
/home/test/bin/pdstop -f -q> /dev/null 2>&1
 
(c) HiRDB system definitions

[Figure] System common definitions

 
set pd_mode_conf = MANUAL1
set pd_ha_ipaddr_inherit = Y
set pd_ha   = use
pdunit -x pkghost -u puid -d /home/test
pdstart -t SDS -s sds -x pkghost
 

Note: Specify the host name that corresponds to the repositionable IP address for accessing the package.

[Figure] Unit information definition

 
set pd_hostname = vr2001