The ASE_HA.sh script is used to start, stop, and monitor an Adaptive Server in a high availability environment. Adaptive Server includes this script in the $SYBASE/$SYBASE_ASE/install directory. You must make a copy of this script and modify it for your environment for both Adaptive Servers running in the cluster. The modifications you make to the script will slightly differ depending on whether the script is for the primary or secondary companion. Each node has a copy of this script at the same location (for example, both nodes have a copy of the script in /usr/u/sybase), and both copies only have read, write, and execute permissions for “root.” An easy way to do this is to first modify both scripts on the same node, copy both the scripts to the other node, and then set the appropriate permissions for the scripts on both nodes.
To modify the script for your environment:
Change to the $SYBASE/$SYBASE_ASE/install directory.
As root, copy ASE_HA.sh to the HACMP event handler script directory, usually in /usr/sbin/cluster/events, and name it:
RUNHA_<server_name>.sh
where server_name is the Adaptive Server to be monitored.
For example, to copy a ASE_HA.sh script for a server named MONEY1 to the /usr/sbin/cluster/events directory, enter:
cp ASE_HA.sh /usr/sbin/cluster/events/RUNHA_MONEY1.sh
You must edit the RUNHA_server_name.sh script for your environment. The original ASE_HA.sh script contains the variables listed below. Edit the lines that include “__FILL_IN__” (and any other lines that require editing) with the values for your site:
MONITOR_INTERVAL – is the interval of time, in seconds, RUNHA_server_name.sh waits between checks to see if the data server process is alive.
RECOVERY_TIMEOUT – is the maximum amount of time the high availability subsystem waits, in seconds, before determining the companion failed to start. Make sure you set this number that is sufficiently long enough for a loaded companion to reboot. RECOVERY_TIMEOUT is also used as the maximum amount of time the subsystem waits for failover and failback to complete.
SHUTDOWN_TIMEOUT – is the maximum time the high availability subsystem waits for the companion to shutdown before killing it.
This value should always be less the amount of time it takes for the HACMP wait time parameter to go into a config_too_long state. This is 360 seconds by default. If there is a possibility that your server will take longer than this to boot up, you can reconfigure this value by executing:
chssys -s clstrmgr -a "-u milliseconds_to_wait"
RESPONSE_TIMEOUT – is the maximum amount of time the subsystem allows for a simple query to return a result set, and is used to diagnose whether or not the companion server is hung. For example, if isql fails to establish a connection in 60 seconds, it automatically times out and exits. However, if isql successfully connects, but does not return a result set, RESPONSE_TIMEOUT may determine that the companion server is hung. By default, RESPONSE_TIMEOUT is set to 999999.
ASE_FAILOVER – can be set to either yes or no:
yes - Monitors the companion server for hung or dead processes and stops HACMP services on this node so the devices failover to the secondary node. If set to “yes”, one must run sp_companion configure on the server as well to keep the high availability consistent.
no - Do not bring down the HACMP subsystem on this node even if the primary companion fails over. This setting is useful if you need to bring down a companion for maintenance or re configuration.
If you are configuring an asymmetric setup, set ASE_FAILOVER to “no.”
WARNING! This should only be set to “yes” if BOTH the servers are running Adaptive Server version 12.0 or later. Adaptive Servers from previous versions set to “no”.
BASIC_FAILOVER – is set to either “yes” or “no:”
yes - Use the failover mechanisms provided by the HACMP subsystem if it determines the servers are running in modes that allow failover. When a failover occurs, the HACMP subsystem monitor first checks if the companions are in a correct mode to perform a failover. If the companions are not enabled for Sybase’s Failover (that is, they do have enable ha set to 1), or they are running in single-server mode, or if the secondary companion is down, the HACMP subsystem monitor checks if BASIC_FAILOVER is set. If it is, the monitor attempts to start up the primary companion on the secondary node.
no - Do not revert to mode 0 failover even if Sybase’s Failover criteria is not met. That is, if BASIC_FAILOVER is set to no, failover does not happen at either the node or the companion level.
retry – is the number of times the HACMP subsystem attempts rebooting on the local node before failing over. Set this to a high number for an asymmetric setup so the secondary companion is more likely to reboot itself if it ever goes down. The default is 0, which means that the companion will not reboot on the same node if it goes down.
SYBASE_ASE – is the installation directory of Sybase Adaptive Server products. The default is ASE-12_0, change this to ASE-12_5.
SYBASE_OCS – is the installation directed of Sybase Open Client products. The default is OCS-12_0, change this to OCS-12_5.
The original lines are:
export SYBASE_ASE = ASE-12_0 export SYBASE_OCS = ASE-12_0
You must change these lines to:
export SYBASE_ASE = ASE-12_5 export SYBASE_OCS = ASE-12_5
PRIM_SERVER – is the name of the primary companion.
SEC_SERVER – is the name of the secondary companion.
PRIM_HOST – is the name of the primary host or service interface name.
SEC_HOST – is the name of the secondary host or service interface name.
PRIM_SYBASE – is the directory to which the $SYBASE environment variable should be set on the primary host. If you are using local devices, the location must be the same on both nodes. If you are using a shared device, this location must be different on both nodes.
SEC_SYBASE – is the directory to which the $SYBASE environment variable should be set on the secondary host. If you are using local devices, the location must be the same on both nodes. If you are using a shared device, this location must be different on both nodes.
PRIM_SYBASE_HOME – is the path to the directory in the secondary host in which the Adaptive Server products are installed. Usually this is $SYBASE/$SYBASE_ASE
PRIM_ISQL – is the path to the isql binary on the primary host.
SEC_ISQL – is the path to the isql binary on the secondary host.
HA_LOGIN – is the login of the user with the sa_role and ha_role. This has to be the same on both the primary and secondary companion.
HA_PWD – is the password for the HA_LOGIN. This has to be the same on both the primary and secondary companion.
PRIM_RUNSCRIPT – is the name of the RUNSERVER file that is used to bring up the primary companion.
PRIM_CONSOLE_LOG – is the full path to the error log for the current primary companion session. This can be any file that has sufficient space and is writable by root. The default is $SYBASE/install.
SEC_CONSOLE_LOG – is the full path to the error log for the current secondary companion session. This can be any file that has sufficient space and is writable by root. The default is $SYBASE/install.
Edit the script for the primary companion. The example below shows the settings in the RUNHA_MONEY1.sh script for primary companion MONEY1 running on host FIN1, and for secondary companion PERSONEL1 running on host HUM1. In this example, when the primary companion shuts down, the monitor script tries one time to reboot the primary companion on node FIN1. If this fails, the script shuts down the HACMP services on FIN1 and moves the database devices for MONEY1 to PERSONEL1 on HUM1. If PERSONEL1 is down or in an inconsistent state, the script starts MONEY1 on HUM1
Variable |
Primary Companion |
---|---|
ASE_FAILOVER |
yes |
BASIC_FAILOVER |
yes |
RETRY |
1 |
SYBASE_ASE |
ASE-12_5 |
SYBASE_OCS |
OCS-12_5 |
PRIM_SERVER |
MONEY1 |
PRIM_HOST |
FIN1 |
HA_LOGIN |
“sa” |
HA_PWD |
“Odd1Think |
PRIM_CONSOLE_LOG |
$SYBASE/$SYBASE_ASE/install/MONEY1.CS_log |
SEC_SERVER |
PERSONEL1 |
SEC_HOST |
HUM1 |
SEC_CONSOL_LOG |
$SYBASE/$SYBASE_ASE/install/PERSONEL.CS_log |
Edit the script for the secondary companion. These values will differ depending on whether you are using an asymmetric or a symmetric setup.
If this is an asymmetric setup, the values for PRIM_SERVER should be the same as SEC_SERVER (the name of the secondary companion). PRIM_HOST should be the same as SEC_HOST, and PRIM_SYBASE should be the same as SEC_SYBASE.
If this is a symmetric setup, the values for the PRIM_SERVER, PRIM_HOST, PRIM_SYBASE, SEC_SERVER, SEC_HOST, and SEC_SYBASE in the secondary companion script are the opposite of what is set in the primary companion script.
Table 8-1 describes the values for the variables for both an asymmetric setup and a symmetric setup on primary companion MONEY1 and secondary companion PERSONEL1:
Variables |
Asymmetric Secondary companion |
Symmetric Secondary Companion |
---|---|---|
RETRY |
10 |
1 |
ASE_FAILOVER |
no |
yes |
BASIC_FAILOVER |
no |
yes |
PRIM_SERVER |
PERSONEL1 |
PERSONEL1 |
PRIM_HOST |
HUM1 |
HUM1 |
SEC_SERVER |
PERSONEL1 |
MONEY1 |
SEC_HOST |
HUM1 |
FIN1 |