Skip to content

3. Configuring Altibase Heartbeat#

This chapter explains how to configure Altibase Heartbeat, and how to configure a distributed database environment with Altibase Heartbeats.

Configuration#

This section explains the necessary configuration for using Altibase Heartbeats in a distributed database environment.

Environment Variables#

Mandatory Environment Variables#

The following environment variables must be set to use Altibase Heartbeats:

  • ALTI_HBP_HOME
    Sets the Altibase Heartbeat home directory. And sets the ALTI_HBP_HOME/bin on the environment variables PATH as follows.

    export PATH=$ALTI_HBP_HOME/bin:$PATH : PATH
    
  • ALTI_HBP_ID
    Sets an ID to identify the node on which Altibase Heartbeats reside. The value must be an integer between 1 and 99, and each node must have a unique ID. Since the ID 0 indicates that aheartbeat exists in an external network, an internal network node cannot take 0 as its ID.

  • ALTI_HBP_ALTIBASE_PORT_NO
    Sets Altibase server's listening port number which the Altibase Heartbeat is to monitor; this is the listening port number of the Altibase server that exists on the same node as the aheartbeat.

  • ALTI_HBP_DETECT_INTERVAL
    Sets the interval (in seconds) after which the Altibase Heartbeat monitors Altibase server failure.

  • ALTI_HBP_DETECT_HIGHWATER_MARK
    Sets the number of failed connections to tolerate before determining a failure when the aheartbeat receives no response from the Altibase server it is monitoring or aheartbeats on other nodes.

Optional Environment Variables#

If necessary, the following environment variables can be set additionally.

  • ALTI_HBP_ALTIBASE_FAILURE_EVENT
    The name of an executable script or binary file which the Altibase Heartbeat executes when it detects an Altibase server failure on the same node. On omission, $ALTI_HBP_HOME/bin/altibaseFailureEvent.sh is executed by default.

  • ALTI_HBP_REMOTE_NODE_FAILURE_EVENT
    The name of an executable script or binary file which the Altibase Heartbeat executes when it detects an Altibase server failure on another node. On omission, $ALTI_HBP_HOME/bin/remoteNodeFailureEvent.sh is executed by default.

Setting aheartbeat Nodes#

The purpose of the aheartbeat.settings file is to configure a distributed environment which uses Altibase Heartbeats. This file stores information on all nodes consisting the distributed environment, and exists in the $ALTI_HBP_HOME/conf directory. To execute Altibase Heartbeat, it is imperative that this file exists.

The information stored in the aheartbeat.settings file consists of the ID, IP address and aheartbeat's listening port number on each node. This information is necessary for aheartbeats to connect to aheartbeats on other nodes.

If one server has many IP addresses, you can specify up to four sets of different IP addresses for the same ID. Also, IPs of different versions can be set for the same ID.

# ID   IP                  PORT
0      169.215.114.23    55778     # public domain
0      222.112.231.234   55778     # public domain
1      192.168.2.33       55444
1      222.112.181.231   55444     # public domain
2      192.168.2.33       54321
2      ::ffff:c0a8:221   54321     # IPv6

In the above example, Node 0 has two IP addresses (169.215.114.23, 222.112.231.234) and aheartbeat's listening port number is 55778. Node 1 has two IP addresses (192.168.2.33, 222.112.181.231) and aheartbeat's listening port number is 55444.

Two IP addresses of different versions are set to the same ID for Node 2 (IPv4: 192.168.2.33, IPv6: ::ffff:c0a8:221) and aheartbeat's listening port number is 55321. Comments can be left with a #.

Note#

The settings in the aheartbeat.settings file must be identical for all of the nodes comprising a distributed environment. Otherwise, Altibase Heartbeat can malfunction.

Failover Execution File#

When aheartbeat fails to connect to an Altibase server on its node or aheartbeats on other nodes (or simply put, detects a failure), it executes the failover execution file. The failover execution file must be in the $ALTI_HBT_HOME/bin directory and the file name can be set with the ALTI_HBP_ALTIBASE_FAILURE_EVENT, ALTI_HBP_REMOTE_NODE_FAILURE_EVENT environment variables described above.

The default script file for failover is as follows.

  • altibaseFailureEvent.sh
    This script file is executed when Altibase Heartbeat detects an Altibase server failure on the same node. Tasks, such as notifying DBAs of failures or restarting the failed Altibase server, can be included.

  • remoteNodeFailureEvent.sh
    This script file is executed when Altibase Heartbeat detects a failure on another node. Tasks, such as performing Failover to the services of a failed database, can be included.

Database administrators can override failure by modifying the default script file or writing application programs which execute Failover operations.

aheartbeat 0#

In a system where databases in an internal network provide services to clients in an external network, aheartbeat can exist in the external network to detect network failure from the internal to external network. The ID of a node which has aheartbeat in the external network must be 0. Therefore, aheartbeat in the external network is called aheartbeat 0.

The user can decide whether or not to add aheartbeat 0.


Configuring an Altibase Heartbeat System : A Practice Example#

A practice example is provided in this section to show how to configure a distributed environment with Altibase databases and the Altibase Heartbeat utility.

It is possible to provide enforced and continuous database services by incorporating the Altibase Heartbeat utility in a distributed environment consisted of Altibase databases.

Distributed Environment Diagram and Conditions#

Three nodes(A, B, C) exist in the internal network and each node has an Altibase server and aheartbeat.

heartbeat_sample

[Figure 3-1] Distributed Environment Diagram and Conditions

  • Each node's Altibase database has a client requesting services.

  • aheartbeat 0 runs in a public network with the IP address 169.215.114.23, and the listening port number 44000.

  • Each node's IP address, aheartbeat and Altibase server's listening port number are as follows.

    Node IP Address Altibase Server Listerning Port Number aheartbeat Listening Port Number
    A 192.168.100.30 20000 21000
    B 192.168.100.31 30000 31000
    C 192.168.100.32 40000 41000

Setting Environment Variables#

Under the above conditions, the environment variables for each node can be set as follows.

  • aheartbeat 0's Node (external network):

    • ALTI_HBP_HOME=/altibase/hbp_home
    • ALTI_HBP_ID=0
    • ALTI_HBP_DETECT_INTERVAL=3
    • ALTI_HBP_DETECT_HIGHWATER_MARK=10
  • Node A:

    • ALTI_HBP_HOME=/altibase/hbp_home

    • ALTI_HBP_ID=1

    • ALTI_HBP_ALTIBASE_PORT_NO=20000

    • ALTI_HBP_DETECT_INTERVAL=3

    • ALTI_HBP_DETECT_HIGHWATER_MARK=10

  • Node B:

    • ALTI_HBP_HOME=/altibase/hbp_home
    • ALTI_HBP_ID=2
    • ALTI_HBP_ALTIBASE_PORT_NO=30000
    • ALTI_HBP_DETECT_INTERVAL=3
    • ALTI_HBP_DETECT_HIGHWATER_MARK=10
  • Node C:

    • ALTI_HBP_HOME=/altibase/hbp_home
    • ALTI_HBP_ID=3
    • ALTI_HBP_ALTIBASE_PORT_NO=40000
    • ALTI_HBP_DETECT_INTERVAL=3
    • ALTI_HBP_DETECT_HIGHWATER_MARK=10

Note: the ALTI_HBP_ALTIBASE_PORT_NO environment variable is ignored in the 0 Node.

aheartbeat.settings#

The contents of the $ALTI_HBP_HOME/conf/aheartbeat.settings file are identical over all nodes and are as follows.

# ID     IP PORT
0      169.215.114.23        44000    #External Network
1      192.168.100.30        21000    #NODE A
2      192.168.100.31        31000    #NODE B
3      192.168.100.32        41000    #NODE C

Failover Execution File#

Make the necessary changes to the contents of the altibaseFailureEvent.sh and remoteNodeFailureEvent.sh files in the $ALTI_HBP_HOME/bin directory. You can also write an application program for Failover, put the execution binary into the $ALTI_HBP_HOME/bin directory and then set the environment variables.

Starting aheartbeat#

Start Altibase Heartbeat on each node with the following command.

$ aheartbeat -r

The startup order of the nodes is irrelevant. Once aheartbeats are running, the status of each node can be checked with the following command.

$ aheartbeat -i