Contents
Automatic HA is a set of time-saving StreamBase configuration settings that let you quickly and automatically implement support for failover in a high-availability design pattern.
Automatic HA leadership control is based on a design pattern where each server in the HA cluster runs at least two HA applications in addition to running the core application. One of the HA applications (called the HA detection application) performs monitoring and detection, and the other HA applications (called the HA application control handlers) specify behavior of the core application in case of a failover.
When you use automatic HA leadership control StreamBase provides the detection application, and you must provide the applications that control the behavior of the core application.
- Monitoring and detection
-
When you enable automatic HA, StreamBase creates the HA detection application and adds a new container. This application,
haleadershipcontrol.sbapp
, uses an HA Heartbeat adapter to determine whether the other server in the pair has stopped running.If the HA detection module on the nonleader in a two-server cluster determines that the other server is no longer running, it changes the status of its server from nonleader to leader.
- Behavior of core application
-
When you use automatic HA leadership control you must specify what should occur when there is a change in leadership status. To do this, create one or more HA application control handlers based on your particular requirements.
The HA Sample shows a simple case, namely
hacontrolcontainer.sbapp
, which specifies that the core application on the new leader should start dequeuing results as soon as there is a leadership change. - How to control tuples being sent from the new leader
-
When a server becomes the leader you control the output from its core application by means of your HA application control handler application.
For example, to enable dequeuing from the container running the core application you could use
sbadmin modifyContainer
with the--dequeue=ENABLED
option. For an example of this technique, see thehacontrolcontainer.sbapp
in the HA sample, which uses this kind of expression to specify the output from theEnableEnqCmd
Map operator. - How to control the adapters in the server that becomes the leader
-
The HA detection application on each server in an HA pair uses an HA Heartbeat adapter for monitoring and detection. You can change the behavior of this adapter by setting the properties in the server configuration file. Properties include how often to send a heartbeat message, and how long to wait before declaring a timeout.
Enable automatic HA processing in the server configuration file for a pair of StreamBase Servers. This configures StreamBase to automatically add a new container for both servers, which tracks and manages their leadership status in the event of failover; this means that you do not have to write a separate high-availability module for the purpose of shifting I/O and its processes from a primary server to a secondary server.
Automatic leadership control does not cover the requirements of failback, which is the process of re-synchronizing data back to the primary server, halting I/O and application activity again, and cutting back over to the original server.
The following example configuration file has sample settings.
High-availability design patterns typically require that disk-based Query Tables be replicated so that a backup table can be made available in the event of a server failover. Using StreamBase Studio, you can set a property on a StreamBase table indicating it should be replicated. See Replication of Query Tables. (Your TIBCO StreamBase license must enables the use of disk-based Query Tables.)
-
<high-availability> section of the server configuration file