Enabling high availability on a member of a cluster by using REST Administration APIs

You can add high availability (HA) to members of your cluster by using REST Administration APIs.

About this task

System administrators can add HA to members of a cluster 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 add HA to cluster members, see Enabling high availability on cluster members by using the IBM IoT MessageSight Web UI.

In this scenario, an IBM IoT MessageSight server that is a member of a cluster but has HA disabled is paired with another IBM IoT MessageSight server to act as its backup. In this scenario, Server A is already member of a cluster, and becomes the primary node. Server B becomes the standby node in the HA pair. Server A can be a server that has data on it. Server B must be a newly installed IBM IoT MessageSight server or you must complete Step 1 to remove any pre-existing data.

Procedure

  1. Optional: If Server B is a newly installed server, you do not need to perform this step. If Server B is not a newly installed server and has been used for messaging services, you must delete any JMS queues that exist on the server and then clean the store.

    For more information about deleting message queues, see Deleting a queue by using a REST Administration API.

    For more information about cleaning the store, see Starting, restarting and stopping the IBM IoT MessageSight server by using REST Administration APIs.

  2. Configure HA on Server A.
    Use the IBM IoT MessageSight REST API POST method with the following IBM IoT MessageSight configuration URI:
    http://<admin-endpoint-IP:Port>/ima/v1/configuration/
    Ensure that you specify the following HighAvailability object configuration data in the payload of the POST method:
    • "EnableHA": true
    • A value for "Group":
    • A value for "LocalDiscoveryNIC": For example, "LocalDiscoveryNIC": "192.0.2.0"
    • A value for "LocalReplicationNIC": For example, "LocalReplicationNIC": "192.0.3.0"
    • A value for "RemoteDiscoveryNIC": For example, "RemoteDiscoveryNIC": "192.0.2.2"
    • "PreferredPrimary": true
    For more information about configuring a servers as an HA pair, see Configuring IBM IoT MessageSight servers as an HA pair by using REST Administration APIs.
  3. Configure HA on Server B. It is best practice to use a newly installed IBM IoT MessageSight server to act as the standby server in the HA pair.
    Use the IBM IoT MessageSight REST API POST method with the following IBM IoT MessageSight configuration URI:
    http://<admin-endpoint-IP:Port>/ima/v1/configuration/
    Ensure that you specify the following HighAvailability object configuration data in the payload of the POST method:
    • "EnableHA": true
    • The same value for "Group": as that specified for Server A.
    • A value for "LocalDiscoveryNIC": For example, "LocalDiscoveryNIC": "192.0.2.2"
    • A value for "LocalReplicationNIC": For example, "LocalReplicationNIC": "192.0.3.2"
    • The same value for "RemoteDiscoveryNIC": as that specified for "LocalDiscoveryNIC": on the primary server. For example, "RemoteDiscoveryNIC": "192.0.2.0"
    • "PreferredPrimary": false
  4. Configure and enable cluster membership on Server B.
    Use the IBM IoT MessageSight REST API POST method with the following IBM IoT MessageSight configuration URI:
    http://<admin-endpoint-IP:Port>/ima/v1/configuration/
    Ensure that you specify the following ClusterMembership object configuration data in the payload of the POST method:
    • "EnableClusterMembership": true
    • The same value for "ClusterName": as that specified in the cluster membership configuration of Server A.
    • "ControlAddress": of Server B.
    • "MessagingAddress": of Server B.
    Ensure that you also include any other cluster membership configuration parameters that you need so that Server B and Server A can identify and connect to the other members of the cluster, for example, if Server A is using external addresses or ports. For more information about configuring cluster membership on a server, see Configuring cluster membership by using REST Administration APIs.
  5. Restart both servers. Restart Server B first.

    Use the IBM IoT MessageSight REST API POST method on each server with the following IBM IoT MessageSight configuration URI:

    http://<admin-endpoint-IP:port>/ima/v1/service/restart

    Provide object configuration data in the payload of the POST method by using the following schema. Content-type is set to application/json:

    
    {    
      "Service": "Server" 
    }
  6. After your servers have restarted, verify the status of your servers.
    On each server, use the IBM IoT MessageSight REST API GET method with the following URI:

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

    1. Check the status information that is returned for Server A to verify that:
      • Server A is running.
      • The status of the HA service status is Active
      • The value of NewRole is PRIMARY
      • The status of the cluster is Active and the server is connected to other servers in the cluster.
      Excerpt from an example response to the REST API GET method for Server A status:
      {
      "Version":"v1",
      "Server": {  
        "Name": "ServerA.mycompany.com:9089",   
        "UID": "PgOSgS1k",  
        "Status": "Running",
        "State": 1,
        "StateDescription": "Running (production)",
        "ServerTime": "2016-04-15T13:55:01.614Z",
        "UpTimeSeconds": 1604,
        "UpTimeDescription": "0 days 0 hours 26 minutes 44 seconds",
        "Version": "2.0 20160414-1500",
        "ErrorCode": 0,
        "ErrorMessage": ""
      },
      "HighAvailability": {
        "Status": "Active",
        "Enabled": true,
        "Group": "MyHAGroup",
        "NewRole": "PRIMARY",
        "OldRole": "PRIMARY",
        "ActiveNodes": 2,
        "SyncNodes": 2,
        "PrimaryLastTime": "2016-04-15T14:05:22Z",
        "PctSyncCompletion": -1,
        "ReasonCode": 0,
        "RemoteServerName": "ServerB.myCompany.com:9089"
      },
      "Cluster": {
        "Status": "Active",
        "Name": "MyCluster",
        "Enabled": true,
        "ConnectedServers": 2,
        "DisconnectedServers": 0
      
    2. Check the status information that is returned for Server B to verify that:
      • Server B is running.
      • The status of the HA service status is Active
      • The value of NewRole is STANDBY
      • The status of the cluster is Standby and the server is not connected to other servers in the cluster.
      Excerpt from an example response to the REST API GET method for Server B status:
      {
      "Version":"v1",
      "Server": {  
        "Name": "ServerB.myCompany.com:9089",
        "UID": "PgOSgS1k",
        "Status": "Running",
        "State": 10,
        "StateDescription": "Standby",
        "ServerTime": "2016-04-15T14:05:52.850Z",
        "UpTimeSeconds": 1608,
        "UpTimeDescription": "0 days 0 hours 26 minutes 48 seconds",
        "Version": "2.0 20160414-1500",
        "ErrorCode": 0,
        "ErrorMessage": ""
      },
      "HighAvailability": {
        "Status": "Active",
        "Enabled": true,
        "Group": "MyHAGroup",
        "NewRole": "STANDBY",
        "OldRole": "UNSYNC",
        "ActiveNodes": 2,
        "SyncNodes": 2,
        "PrimaryLastTime": "",
        "PctSyncCompletion": -1,
        "ReasonCode": 0,
        "RemoteServerName": "ServerA.myCompany.com:9089"
      },
      "Cluster": {
        "Status": "Standby",
        "Name": "MyCluster",
        "Enabled": true,
        "ConnectedServers": 0,
        "DisconnectedServers": 0
      
  7. Force a failover operation in order to verify that Server B is correctly configured to work with the cluster.
    You can force a failover operation by restarting Server A.
    Use the IBM IoT MessageSight REST API POST method with the following URI:
    http://<admin-endpoint-IP:port>/ima/v1/service/restart

    Provide configuration data in the payload of the POST method by using the following schema. Content-type is set to application/json:

    
    {    
      "Service": "Server"
    }
  8. Verify the status of your servers after the failover.
    On each server, use the IBM IoT MessageSight REST API GET method with the following URI:

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

    1. Check the status information that is returned for Server A to verify that:
      • Server A is running as the standby server.
      • The status of the HA service status is Active
      • The value of NewRole is STANDBY
      • The status of the cluster is Standby and the server is not connected to other servers in the cluster.
      Excerpt from an example response to the REST API GET method for Server A status:
      {
      "Version":"v1",
      "Server": {  
        "Name": "ServerA.myCompany.com:9089",
        "UID": "PgOSgS1k",
        "Status": "Running",
        "State": 10,
        "StateDescription": "Standby",
        "ServerTime": "2016-04-15T14:05:52.850Z",
        "UpTimeSeconds": 360,
        "UpTimeDescription": "0 days 0 hours 6 minutes 0 seconds",
        "Version": "2.0 20160414-1500",
        "ErrorCode": 0,
        "ErrorMessage": ""
      },
      "HighAvailability": {
        "Status": "Active",
        "Enabled": true,
        "Group": "MyHAGroup",
        "NewRole": "STANDBY",
        "OldRole": "UNSYNC",
        "ActiveNodes": 2,
        "SyncNodes": 2,
        "PrimaryLastTime": "",
        "PctSyncCompletion": -1,
        "ReasonCode": 0,
        "RemoteServerName": "ServerB.myCompany.com:9089"
      },
      "Cluster": {
        "Status": "Standby",
        "Name": "MyCluster",
        "Enabled": true,
        "ConnectedServers": 0,
        "DisconnectedServers": 0
          }
      
    2. Check the status information that is returned for Server B to verify that:
      • Server B is running.
      • The status of the HA service is Active
      • The value of NewRole is PRIMARY
      • The status of the cluster is Active and the cluster is connected to other servers in the cluster.
      Excerpt from an example response to the REST API GET method for Server B status:
      {
      "Version":"v1",
      "Server": {  
        "Name": "ServerB.mycompany.com:9089",
        "UID": "PgOSgS1k",
        "Status": "Running",
        "State": 1,
        "StateDescription": "Running (production)",
        "ServerTime": "2016-04-15T13:55:01.614Z",
        "UpTimeSeconds": 1714,
        "UpTimeDescription": "0 days 0 hours 29 minutes 54 seconds",
        "Version": "2.0 20160414-1500",
        "ErrorCode": 0,
        "ErrorMessage": ""
      },
        "HighAvailability": {
        "Status": "Active",
        "Enabled": true,
        "Group": "MyHAGroup",
        "NewRole": "PRIMARY",
        "OldRole": "STANDBY",
        "ActiveNodes": 2,
        "SyncNodes": 2,
        "PrimaryLastTime": "2016-04-15T14:25:01Z",
        "PctSyncCompletion": -1,
        "ReasonCode": 0,
        "RemoteServerName": "ServerA.myCompany.com:9089"
      },
      "Cluster": {
        "Status": "Active",
        "Name": "MyCluster",
        "Enabled": true,
        "ConnectedServers": 2,
        "DisconnectedServers": 0