Hitachi

For Linux(R) (x86) Systems HA Monitor Cluster Software


6.14.2 Creating a command to be executed when the standby server stops

By creating a command that is to be executed when the standby server stops, you can execute process stop and other desired processing when the standby server stops.

This subsection describes how to create a command that is to be executed when the standby server stops and when the created command is called.

Organization of this subsection

(1) Timing at which the command to be executed when the standby server stops is called

If you create the command, HA Monitor executes it with the superuser permissions.

The command is called in the following cases:

HA Monitor passes an appropriate argument to the command according to the case in which the command is called. The arguments that can be passed are -e and -c. The following table describes the relationships among the condition in which the command is started, the argument to be passed, and the processing performed when the argument is passed. When you create a command, code the appropriate processing according to the argument.

Table 6‒13: Relationships among the condition in which the command is started, the argument to be passed, and the processing performed when the argument is passed

Condition in which the command is started

Argument to be passed

Processing performed when the argument is passed

The wait-state server termination command (monsbystp command) is used to terminate the server.

-e

Normally terminate the program.

The standby server is terminated due to a failure on the standby server.

-c

Perform processing to make it possible to restart the abnormally terminated program.

Pre-processing is performed for restarting the standby server in the event of a failure on the standby server.

Startup of the standby server is canceled because the standby-server start command failed.

The wait-state server termination command (mondeact command) is used to forcibly terminate a server in the hot-standby switchover wait state.

The server is forcibly terminated because a failure occurred on a server in the hot-standby switchover wait state.

Notes

The termination command is not called in the standby system when a hot-standby switchover occurs.

(2) How to create a command to be executed when the standby server stops

Create a command that is to be executed when the standby server stops, and code necessary processing. For example, code processing that terminates a command that was started when the standby server started (command specified for the sby_actcommand operand in the server environment definition).

If necessary, specify an operating environment needed to terminate the program within the shell. In RHEL7 or a later version, you can specify environment variables in the Unit settings file. However, the Unit settings file is overwritten when an overwrite installation of HA Monitor is performed. Therefore, we recommend that you specify an operating environment (environment variables) within the shell.

For details about the environment variables that are inherited when the standby server terminating command is executed, see (2) How to create a server termination command in 6.13.2 Creating a server termination command.

If you have created a command, specify it for the sby_termcommand operand in the server environment definition.

You can use the sby_stop_timeout operand in the server environment definition to specify the timeout value for the command.

HA Monitor processing is not affected by the return value of the server termination command that is called when the standby server terminates normally. If the command called when the standby server is restarted terminates with a value other than 0, HA Monitor stops the subsequent processing (restarting the standby server, starting the monitoring command, and monitoring the server). Therefore, restart of the standby server fails. For details about the handling of restart errors, see 7.5.2 Handling server restart errors.