Editing the ASE_HA.sh script

The ASE_HA.sh template script configures the high availability system to start, stop, and monitor Adaptive Server for failover. The ASE_HA.sh template script is included in the $SYBASE/$SYBASE_ASE/install directory. Make a copy of this script in the package subdirectory you created in step 1 in the previous section, and modify it to include the environment variables for your cluster environment. Both the primary and secondary companions require a copy of this script. As “root,” perform the following steps:

  1. If you are currently using a script to configure Adaptive Server applications to run in your high availability system, make a backup copy of this file. For example, if you have a script named SYBASE1.sh, copy it to SYBASE1.sh.backup.

  2. On the primary node, change to the package subdirectory under /etc/cmcluster. For example, if you are configuring the primary companion MONEY1:

    cd /etc/cmcluster/MONEY1
    
  3. Copy the ASE_HA.sh template script from the $SYBASE/$SYBASE_ASE/install directory to the primary companion’s package subdirectory. Use the following syntax for the package template name:

    <package_name>.sh
    

    where package_name is the name of the companion server you are configuring. For example, to make a copy of the ASE_HA.sh file for MONEY1:

    cp ASE_HA.sh /etc/cmcluster/MONEY1/MONEY1.sh
    
  4. Edit the server_name.sh file for your environment. Edit the lines that include “__FILL_IN__” (and any other lines that require editing for your site). This is a list of these lines:

    • ASE_12_0 – specifies the version of Adaptive Server. This indicates whether the $SYBASE directory structure is $SYBASE/$SYBASE_ASE/bin (starting with 12.0) or $SYBASE/bin (before 12.0)Set this to:

      • Yes if both servers are using Sybase Adaptive Server version 12.0 or later.

      • No if you are using earlier versions of Adaptive Server.

    • ASE_HAFAILOVER – specifies whether you are using Sybase Failover. Set this to:

      • Yes if you are using Sybase Failover.

      • No if you are using mode 0 failover.

    • BASIC_FAILOVER – is set to either yes or no:

      • Yes – use the failover mechanisms provided by the HP MC/ServiceGuard high availability system if it determines the servers are running in modes that allow failover.

        When a failover occurs, the script 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 are running in single-server mode), the script attempts to start the primary companion on the secondary node.

      • No – do not revert to mode 0 failover.

        That is, if BASIC_FAILOVER is set to no, failover does not happen at either the node or the companion level.

    • PACKAGE_NAME – the name of the package as specified in the MC/ServiceGuard package configuration script.

      NoteThe value of PACKAGE_NAME must be the same as the companion name.

    • MONITOR_INTERVAL – the amount of time, in seconds, this script waits between checks to see if the Adaptive Server process is alive.

    • SHUTDOWN_TIMEOUT – the maximum amount of time, in seconds, to wait for a companion server abort to complete before killing the Sybase Adaptive Server process. SHUTDOWN_TIMEOUT protects a suspended companion server that prevents the halt script from completing. The value of SHUTDOWN_TIMEOUT must be less than the timeout variable set in the package configuration file.

    • RECOVERY_TIMEOUT – the maximum amount of time the high availability system waits, in seconds, before determining that the companion failed to start. Set this number high enough to allow 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.

    • SYBASE – the location where Sybase products are installed. This value is automatically set to PRIM_SYBASE if you are on primary host and to SEC_SYBASE if you are on the secondary host.

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

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

    • SYBUSER – the name of the user who starts the Adaptive Server session.

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

    • HAPWD – the password for HALOGIN. This must be the same on both the primary and secondary companion.

      NoteHA_LOGIN and HA_PWD must be the same name and password used when configuring Adaptive Server as a companion server (that is, when running sp_companion).

    • PRIM_SYBASE – the path to the directory in the primary node in which the Adaptive Server products are installed. 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 each node.

    • PRIM_ASE_HOME – the path to the directory in which the Adaptive Server products are installed on the primary node. The default is $SYBASE/$SYBASE_ASE.

    • PRIM_SERVER – the name of the primary companion.

    • PRIM_HOSTNAME – the name of the primary node.

    • 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 SYBUSER. The default is $SYBASE/$SYBASE_ASE/install/server_name.cs_log.

    • PRIM_RUNSCRIPT – the name of the RUNSERVER file that is used to bring up the primary companion. The default is $SYBASE/$SYBASE_ASE/install/RUN_server_name.

    • SEC_SYBASE – the directory in which the Adaptive Server products are installed on the secondary node. 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_ASE_HOME – the path to the directory in which the Adaptive Server products are installed on the secondary node. The default is $SYBASE/$SYBASE_ASE.

    • SEC_SERVER – the name of the secondary companion.

    • SEC_HOSTNAME – the name of the secondary node.

    • 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 SYBUSER. The default is $SYBASE/$SYBASE_ASE/install/server_name.cs_log.

    • ISQL – the path to the isql binary. The default is $SYBASE/$SYBASE_OCS/bin/isql.

    Table 7-1 shows the ASE_HA.sh settings in MONEY1.sh for the primary companion MONEY1 running on host FN1, and for the secondary companion PERSONNEL1, running on host HUM1. Both use a local file system. During failover, MONEY1 restarts on HUM1 if PERSONNEL1 is not running or not in companion mode.

    Table 7-1: Settings for MONEY1 in the ASE_HA.sh script

    Variable

    Setting

    ASE_12_0

    yes

    ASE_HAFAILOVER

    yes

    BASIC_FAILOVER

    yes

    PACKAGE_NAME

    MONEY1

    MONITOR_INTERVAL

    5

    SHUTDOWN_TIMEOUT

    60

    RECOVERY_TIMEOUT

    300

    SYBASE_ASE

    ASE-15_0

    SYBASE_OCS

    OCS-15_0

    HALOGIN

    “SA”

    HAPASSWD

    “Odd2Think”

    PRIM_ASE_HOME

    Defaults to directory $SYBASE/$SYBASE_ASE

    PRIM_SYBASE

    /opt/sybase

    PRIM_SERVER

    MONEY1

    PRIM_HOSTNAME

    FN1

    PRIM_CONSOLE_LOG

    $PRIM_SYBASE/$SYBASE_ASE/install/MONEY1.cs_log

    PRIM_RUNSCRIPT

    Name of RUNSERVER file – default to $SYBASE/$SYBASE_ASE/install/RUN_<servername>

    SYBASE

    PRIM_SYBASE for primary and SEC_SYBASE if on the secondary host. Automatically set.

    SEC_ASE_HOME

    Default $SYBASE/$SYBASE_ASE

    SEC_SYBASE

    /opt/sybase

    SEC_SERVER

    PERSONNEL1

    SEC_HOSTNAME

    HUM1

    ISQL

    Default $SYBASE/$SYBASE_OCS/bin/isql

    SEC_CONSOLE_LOG

    $PRIM_SYBASE/$SYBASE_ASE/install/PERSONNEL1.cs_log

  5. Change the permission on the file to 700 so it is only readable, writable, and executable by “root”. For example, to change permissions for MONEY1.sh, enter:

    chmod 700 MONEY1.sh
    
  6. Distribute the script to the secondary node. For example, to distribute the file to the secondary node HUM1:

    rcp /etc/cmcluster/MONEY1/MONEY1.sh HUM1:/etc/cmcluster/MONEY1/MONEY1.sh
    
  7. Repeat the above steps for the secondary companion.

    The secondary companion package script uses values for PRIM_SERVER, PRIM_HOSTNAME, PRIM_SYBASE, SEC_SERVER, SEC_HOSTNAME, and SEC_SYBASE that are the opposite of the primary companion package script. Table 7-2 shows values for PERSONNEL1.sh.

    Table 7-2: Settings for PERSONNEL1 in the ASE_HA.sh script

    Variable

    Setting

    ASE_12_0

    yes

    ASE_HAFAILOVER

    yes

    BASIC_FAILOVER

    yes

    PACKAGE_NAME

    PERSONNEL1

    MONITOR_INTERVAL

    5

    SHUTDOWN_TIMEOUT

    60

    RECOVERY_TIMEOUT

    300

    SYBASE_ASE

    ASE-15_0

    SYBASE_OCS

    OCS-15_0

    HALOGIN

    “SA”

    HAPASSWD

    “Odd2Think

    PRIM_SYBASE

    /opt/sybase

    PRIM_SERVER

    PERSONNEL1

    PRIM_HOSTNAME

    HUM1

    PRIM_CONSOLE_LOG

    $PRIM_SYBASE/$SYBASE_ASE/install/MONEY1.cs_log

    PRIM_RUNSCRIPT

    Name of RUNSERVER file – default to $SYBASE/$SYBASE_ASE/install/RUN_<servername>

    SEC_SYBASE

    /opt/sybase

    SEC_SERVER

    MONEY1

    EC_HOSTNAME

    FN1

    SEC_CONSOLE_LOG

    $PRIM_SYBASE/$SYBASE_ASE/install/PERSONNEL1.cs_log