solidDB Help : Samples : HotStandby with High Availability Controller and High Availability Manager sample
HotStandby with High Availability Controller and High Availability Manager sample
This sample demonstrates a working setup of HotStandby (HSB) and the High Availability Controller (HAC).
The files for the sample are located in the soliddb-installdir\samples\hac directory. For general information about running the samples, see Samples.
The HAC maintains the availability of the database service by detecting failures, performing failovers to standby units, and restarting failed processes when necessary. For more information, see High Availability Controller.
The sample also includes an example of a High Availability Manager (HAM) in the form of a Java program (HAManager.jar) that displays the state of the HSB servers and HACs. It also provides basic functionality for managing HACs, for example, by switching the roles of HSB servers and to suspend and resume HACs. For more information, see High Availability Manager (sample).
Running the sample
Run the runme script (runme.bat in Windows), which completes the following steps to demonstrate HAC and HAM operations:
Startup
1 The HAM is started. The HAM interface shows that neither HAC is available. The HAM interface continues to reflect the roles and states of the HACs and servers as the demonstration continues.
2 The first, and second HACs (hac1, and hac2, respectively) are started. Each HAC executes the solidDB start up script that is named in the solidhac.ini configuration file.
3 Since server1, and server2 are configured (in solid.ini) as HSB servers, the servers start in the SECONDARY ALONE state.
4 As both servers have empty databases, either server could become the primary server. However, server1, is configured (in solidhac.ini) as the preferred primary server so, in this situation, the HAC changes server1 to PRIMARY ALONE state.
5 The HAC (hac1 and hac2 together) notices that the servers are not connected (transaction replication cannot happen), and so the HAC executes the necessary admin commands to connect the servers and change server1 to the PRIMARY ACTIVE state, and server2 to the SECONDARY ACTIVE state.
6 A script (Primary1.sql) runs to create a table on server1.
7 A script runs (Primary2.sql) to add a row to server1 and show that the row is in the database.
8 A script runs (Secondary1.sql) to show that the row is also in the database on server2.
Demonstrating recovery from primary server failure
1 The primary server (server1) fails.
2 The HAC detects that the primary server is not available, performs the switchover, and restarts server1. server2, the original secondary server, becomes the new primary server with the state PRIMARY ALONE.
3 server1 restarts with state SECONDARY ALONE.
4 The HAC re-establishes the HSB connection between the servers, server1 changes to SECONDARY ACTIVE state, and server2 changes to PRIMARY ACTIVE state.
5 An admin command is run to switch the role of the servers (server1 is now the primary server again and server2 is the secondary server).
Demonstrating recovery from secondary server failure
1 The secondary server (server2) fails.
2 The HAC detects that the secondary server is not available, sets server1 to PRIMARY ALONE state, and restarts server2.
3 server2 restarts with state SECONDARY ALONE.
4 The HAC re-establishes the HSB link between the servers, server1 changes to PRIMARY ACTIVE state, and server2 changes to SECONDARY ACTIVE state.
Demonstrating recovery from standalone state
1 hac1, server2, and hac2 are shut down.
2 An admin command is run to change server1 to STANDALONE state.
3 server2 is started in backupserver mode.
4 hac1 and hac2 are restarted.
5 The HAC (hac1 and hac2 together) notices that the servers are not connected (that is, that transaction replication is not active), and so the HAC executes the necessary admin commands to perform the following tasks:
▪ synchronize the content of the database,
▪ change server1 to the PRIMARY ACTIVE state,
▪ change server2 to the SECONDARY ACTIVE state.
At this point you can experiment with using the HAM application to shutdown servers and switch server roles.