Viewing the status of the high availability service by using a REST Administration API

System administrators can view the status of the high availability (HA) service by using the IBM® IoT MessageSight REST API GET method.

About this task

You can view HA service status by using REST Administration APIs, or by using the IBM IoT MessageSight Web UI. For more information about using the IBM IoT MessageSight Web UI to view HA service status, see Configuring IBM IoT MessageSight servers as an HA pair by using the IBM IoT MessageSight Web UI.

Procedure

To view the status of the HA service, use the IBM IoT MessageSight REST API GET method with the following IBM IoT MessageSight service URI:

http://<admin-endpoint-IP:Port>/ima/v1/service/status/HighAvailability

Note: The status of the HA service is also returned as part of the data that is returned from the IBM IoT MessageSight REST API GET method with the following URI:

http://<admin-endpoint-IP:Port>/ima/v1/service/status

Results

The following HA status information is returned:
Status
Whether HA is running or not. Possible values, and their meanings, are:
Active
HA is enabled and is running.
Inactive
HA is not running. If HA is enabled, the HA service attempts to restart if the server is restarted.
Enabled
Whether HA is enabled or not. Possible values, and their meanings, are:
true
HA is enabled.
false
HA is not enabled. The HA service does not attempt to restart if the server is restarted.
Group
The name of the HA group to which the server belongs.
NewRole
The current role of the server in the HA pair. Possible values, and their meanings, are:
PRIMARY
The server is running as a primary node.
STANDBY
The server is running as the standby node.
HADISABLED
The server is disabled in the HA pair and is not restarted.
UNSYNC
The server is out of sync with the primary node. An attempt will be made to synchronize the server with the primary node.
UNSYNC_ERROR
The server has become unsynchronized due to an unrecoverable error.
UNKNOWN
If HA is enabled and the server is restarted, the initial role of the server is UNKNOWN until the role of the server is set during the synchronization process.
OldRole
The previous role of the server in the HA pair. Possible values, and their meanings, are:
PRIMARY
The server is running as a primary node.
STANDBY
The server is running as the standby node.
HADISABLED
The server is disabled in the HA pair and is not restarted.
UNSYNC
The server is out of sync with the primary node. An attempt will be made to synchronize the server with the primary node.
UNSYNC_ERROR
The server has become unsynchronized due to an unrecoverable error.
UNKNOWN
If HA is enabled and the server is restarted, the initial role of the server is UNKNOWN until the role of the server is set during the synchronization process.
ActiveNodes
The number of active nodes in the HA pair.
SyncNodes
The number of synchronized nodes in the HA pair.
PrimaryLastTime
The time when the server became the primary server in the HA pair.
This field is returned only on the primary server.
PctSyncCompletion
The progress, expressed as a percentage, that has been reached in the synchronization procedure on the primary node.
A value of -1 is presented if synchronization is not in process or if the server is not the primary server.
ReasonCode
The reason code if the server is in an error state.

If the status is Inactive but HA is enabled, there might be a problem that is preventing HA from running. After you have resolved the problem, you can enable HA. For more information about enabling HA, see Configuring IBM IoT MessageSight servers as an HA pair by using REST Administration APIs.

Example

The following example demonstrates displaying the HA service by using cURL.

curl -X GET http://127.0.0.1:9089/ima/v1/service/status/HighAvailability

The following example shows an example response to the GET method:


{
  "Version":"v1",
  "HighAvailability": {
    "Status": "Active",
    "Enabled": true,
    "Group": "MyHAGroup",
    "NewRole": "PRIMARY",
    "OldRole": "PRIMARY",
    "ActiveNodes": 2,
    "SyncNodes": 2,
    "PrimaryLastTime": "2016-04-21T19:30:05Z",
    "PctSyncCompletion": -1,
    "ReasonCode": 0,
    "RemoteServerName": "ServerB.mycompany.com"
  }
}