Configuring IBM IoT MessageSight servers as an HA pair by using REST Administration APIs

In this scenario, an IBM® IoT MessageSight server that has high availability (HA) disabled is now paired with another IBM IoT MessageSight server to act as its backup. System administrators can configure a pair of servers for high availability by using REST Administration APIs.

About this task

You can configure IBM IoT MessageSight servers for high availability 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 configure servers for HA, see Configuring IBM IoT MessageSight servers as an HA pair by using the IBM IoT MessageSight Web UI.

In this scenario, Server A is the primary node and Server B is the standby node in the HA pair. Server A can be a server that has data on it. Any data on Server B will be destroyed.

Procedure

  1. On Server A, configure the primary server for HA by using the IBM IoT MessageSight REST API POST method.
    1. Use the following IBM IoT MessageSight configuration URI:

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

    2. Provide HighAvailability object configuration data in the payload of the POST method by using the following schema. Content-type is set to application/json. Ensure that capitalization and double quotation marks are used as shown.
      
      {    
         "HighAvailability": {
            "Group": "string",
            "EnableHA": true,
            "StartupMode": "AutoDetect",
            "RemoteDiscoveryNIC": "string",
            "LocalReplicationNIC": "string",
            "LocalDiscoveryNIC": "string",
            "DiscoveryTimeout": integer,
            "HeartbeatTimeout": integer,
            "PreferredPrimary": true          
          }
      }
      Where:
      Group
      The group name of the HA pair. The value must be the same on both servers in the pair.
      RemoteDiscoveryNIC
      Specifies the IP address of the NIC that is used for HA discovery on the remote (standby) node in the HA pair.
      LocalDiscoveryNIC
      Specifies the IP address of the NIC that is used for HA discovery on the local (primary) node in the HA pair.
      LocalReplicationNIC
      Specifies the IP address of the NIC that is used for HA discovery on the local (primary) node in the HA pair.
      DiscoveryTimeout
      Specifies the time in seconds that the node attempts to discover the HA pair node.
      The value must be in the range 10-2147483647.
      The default value is 600.
      HeartbeatTimeout
      Specifies the time in seconds to detect that the other node in the HA pair has failed.
      The value must be in the range 1-2147483647.
      The default value is 10.
  2. 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.

  3. On Server B, configure the standby server for HA by using the IBM IoT MessageSight REST API POST method.
    1. Use the following IBM IoT MessageSight configuration URI:

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

    2. Provide HighAvailability object configuration data in the payload of the POST method by using the following schema. Content-type is set to application/json. Ensure that capitalization and double quotation marks are used as shown.
      
      {    
         "HighAvailability": {
            "Group": "string",
            "EnableHA": true,
            "StartupMode": "AutoDetect",
            "RemoteDiscoveryNIC": "string",
            "LocalReplicationNIC": "string",
            "LocalDiscoveryNIC": "string",
            "DiscoveryTimeout": integer,
            "HeartbeatTimeout": integer,
            "PreferredPrimary": false          
          }
      }
  4. Stop and then restart both IBM IoT MessageSight servers. Ensure that you restart server B in production mode.
    1. Use the IBM IoT MessageSight REST API POST method with the following IBM IoT MessageSight configuration 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. Ensure that capitalization and double quotation marks are used as shown.
      
      {    
        "Service": "Server"      
      }
    Tip: As a best practice, restart the standby server first. Then restart the primary to limit the amount of time that the primary spends waiting for the standby to become available.

What to do next

You can view HA configuration details of the IBM IoT MessageSight server by using the IBM IoT MessageSight REST API GET method with the following IBM IoT MessageSight configuration URI:
http://<admin-endpoint-IP:Port>/ima/v1/configuration/HighAvailability
You can view information about the HA role of the IBM IoT MessageSight server by using the IBM IoT MessageSight REST API GET method with the following IBM IoT MessageSight configuration URI:
http://<admin-endpoint-IP:Port>/ima/v1/service/status/HighAvailability