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 differ slightly depending on whether the script is for the primary or secondary companion. You must install the ASE_HA.sh script in /var/cluster/caa/script/ASE_server_name.scr.
To modify the script for your environment:
Change to the $SYBASE/$SYBASE_ASE/install directory.
As root, copy ASE_HA.sh to a file named /var/cluster/caa/script/server_name.scr.
where server_name is the Adaptive Server to be monitored.
For example, to copy a ASE_HA.sh script for a server named MONEY1:
cp ASE_HA.sh /var/cluster/caa/script/MONEY1.scr
You must edit the server_name.scr 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:
RECOVERY_TIMEOUT – The maximum amount of time the high availability subsystem waits, in seconds, before determining that the companion failed to start. Make sure you set this number 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 – The maximum time the high availability subsystem waits for the companion to shut down before killing it.
This value should always be less than the amount of time configured for the action script time_out in the profile.
RESPONSE_TIMEOUT – The maximum amount of time the subsystem allows for a simple query to return a result set. Its 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.If
yes - Monitors the companion server for hung or dead processes and relocates the TruCluster service to the secondary node. If set to “yes”, sp_companion...configure must be run on the server as well to keep the high availability consistent.
If no - Do not relocate the TruCluster 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” on the secondary server.
WARNING! This should only be set to “yes” if BOTH the servers are running Adaptive Server version 12.0 or later. Adaptive Servers for previous versions should be set to “no”.
BASIC_FAILOVER – Set to either “yes” or “no”.If
yes - Use the failover mechanisms provided by the TruCluster subsystem if it determines the servers are running in modes that allow failover. When a failover occurs, the TruCluster 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, have enable ha set to 1), or they are running in single-server mode, or if the secondary companion is down, the TruCluster subsystem monitor checks whether BASIC_FAILOVER is set. If it is, the monitor attempts to start up the primary companion on the secondary node.
If no - Do not revert to mode0 failover (mode 0 restarts the primary companion on the secondary node, and does not involve Sybase’s 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.
SYBASE – The $SYBASE environment variable.
retry – The number of times the TruCluster subsystem attempts to reboot 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 goes down. The default is 0, which means that the companion will not reboot on the same node if it goes down.
SYBASE_ASE – The installation directory of Sybase Adaptive Server products. The default is ASE-12_0.
SYBASE_OCS – The installation directory of Sybase Open Client products. The default is OCS-12_0.
PRIM_SERVER – The name of the primary companion.
SEC_SERVER – The name of the secondary companion.
PRIM_HOST – The name of the primary host or service interface.
SEC_HOST – The name of the secondary host or service interface name.
HA_LOGIN – The login of the user with the sa_role and ha_role. This must be the same on the primary and the secondary companion.
HA_PWD – The password for the HA_LOGIN. This has to be the same on both the primary and secondary companion.
Edit the script for the primary companion. The example below shows the settings in the server_name.scr script for primary companion MONEY1 running on host FIN1, and for secondary companion PERSONNEL1 running on host HUM1. In this example, when the primary companion shuts down, the monitor script tries once to reboot the primary companion on node FIN1. If this fails, the script shuts down the TruCluster services on FIN1 and moves the database devices for MONEY1 to PERSONNEL1 on HUM1. If PERSONNEL1 is down or in an inconsistent state, the script starts MONEY1 on HUM1.
Variable |
Primary Companion |
---|---|
ASE_FAILOVER |
yes |
BASIC_FAILOVER |
yes |
RETRY |
1 |
PRIM_SERVER |
MONEY1 |
PRIM_HOST |
FIN1 |
HA_LOGIN |
“sa” |
HA_PWD |
“Odd1Think |
SEC_SERVER |
PERSONNEL1 |
SEC_HOST |
HUM1 |
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.
If this is a symmetric setup, the values for the PRIM_SERVER, PRIM_HOST, SEC_SERVER, and SEC_HOST in the secondary companion script are the opposite of what is set in the primary companion script.
Table 9-1 describes the values for the variables for both an asymmetric setup and a symmetric setup on primary companion MONEY1 and secondary companion PERSONNEL1:
Variables |
Asymmetric secondary companion |
Symmetric secondary companion |
---|---|---|
RETRY |
10 |
1 |
ASE_FAILOVER |
no |
yes |
BASIC_FAILOVER |
no |
yes |
PRIM_SERVER |
PERSONNEL1 |
PERSONNEL1 |
PRIM_HOST |
HUM1 |
HUM1 |
SEC_SERVER |
PERSONNEL1 |
MONEY1 |
SEC_HOST |
HUM1 |
FIN1 |
Register your server_name.cap file. The syntax is
caa_register PRIM_SERVER
and
caa_register SEC_SERVER
Start the server_name.cap file. The syntax is:
caa_start PRIM_SERVER
and
caa_start SEC_SERVER