Modifying the ASE_HA.sh script

The ASE_HA.sh script is used to start, stop, and monitor Adaptive Server in a high availability environment. Adaptive Server includes this script in the $SYBASE/$SYBASE_ASE/install directory. Make a copy of this script and modify it for your environment for both Adaptive Servers in the cluster. The modifications you make to the script depend on whether the script is for the primary or secondary companion. Each node must have 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 must have read, write, and execute permissions for “root”. The easiest way to do this is to first modify both scripts on the same node, copy both the scripts to the other node, then set the appropriate permissions for the scripts on both nodes.

To modify the script for your environment:

  1. Change to the $SYBASE/$SYBASE_ASE/install directory.

  2. As “root”, copy ASE_HA.sh to the HACMP event handler script directory, usually /usr/sbin/cluster/events, and enter the following, where servername is the Adaptive Server to be monitored.:

    RUNHA_<servername>.sh
    
  3. You must edit the RUNHA_<servername>.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 – the interval of time, in seconds, RUNHA_<servername>.sh waits between checks to see if the data server process is alive.

    • RECOVERY_TIMEOUT – the maximum amount of time, in seconds, the high availability system waits before determining that the companion did not start. Set this number high enough for a loaded companion to restart. RECOVERY_TIMEOUT is also used as the maximum amount of time the subsystem waits for the failover and failback to complete.

    • SHUTDOWN_TIMEOUT – the maximum amount of time the high availability system waits for the companion to shut down before killing it.

      NoteThis value should always be less than the amount of time it takes for the HACMP wait time parameter to go into a config_too_long state. By default this is 360 seconds. If your server takes longer than this to start, reconfigure this value by executing:

          chssys -s clstrmgr -a "-u milliseconds_to_wait"

    • RESPONSE_TIMEOUT – the maximum amount of time the subsystem allows for a simple query to return a result set is used to diagnose whether 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 has stopped responding. By default, RESPONSE_TIMEOUT is set to 999999.

    • ASE_FAILOVER – set to:

      • yes – monitors the companion server for stopped or dead processes and stops HACMP services on this node so the devices fail over to the secondary node. You must also run sp_companion configure on the server.

      • no – do not bring down the HACMP subsystem on this node even if the primary companion fails over. This setting is useful if you must bring down a companion for maintenance or reconfigure.

        If you are configuring an asymmetric setup, set ASE_FAILOVER to no.

      WARNING! Set ASE_FAILOVER to “yes” only if both servers are running Adaptive Server Version 12.0 or later. For version earlier than 12.0 set ASE_FAILOVER to “no”.

    • BASIC_FAILOVER – set to:

      • 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 Failover (that is, they have enable ha set to 1), if 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 the primary companion on the secondary node.

      • no – do not revert to mode 0 failover even if Sybase Failover criteria is not met. That is, if BASIC_FAILOVER is set to no, failover neither at the node nor the companion level.

    • retry – the number of times the HACMP subsystem attempts to restart 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 restart itself if it ever goes down. The default is 0, which means that the companion does not restart on the same node if it goes down.

    • SYBASE_ASE – the installation directory of Sybase Adaptive Server products.

    • SYBASE_OCS – the installation directory of Sybase Open Client products.

    • PRIM_SERVER – the name of the primary companion.

    • SEC_SERVER – the name of the secondary companion.

    • PRIM_HOST – the name of the primary host as returned by hostname.

    • SEC_HOST – the name of the secondary host as returned by the hostname.

      WARNING! You must set PRIM_HOST and SEC_HOST to the string as returned by hostname command, otherwise, failover or failback may not happen properly.

    • PRIM_SYBASE – 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 – 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 – the path to the directory in the secondary host in which the Adaptive Server products are installed. Usually this is $SYBASE/$SYBASE_ASE.

    • SEC_SYBASE_HOME – 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 – the path to the isql binary on the primary host.

    • SEC_ISQL – the path to the isql binary on the secondary host.

    • HA_LOGIN – the login of the user with the sa_role and ha_role. This must be the same on the primary and secondary companion.

    • HA_PWD – the password for the HA_LOGIN. This must be the same on the primary and secondary companion.

    • PRIM_RUNSCRIPT – the name of the RUNSERVER file that is used to bring up the primary companion.

    • PRIM_CONSOLE_LOG – 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/$SYBASE_ASE/install.

    • SEC_CONSOLE_LOG – 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/$SYBASE_ASE/install.

  4. Edit the script for the primary companion.

  5. Edit the script for the secondary companion. These values differ depending on whether you are using an asymmetric or a symmetric configuration.

    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.