The NSX Advanced Load Balancer REST API provides commands for managing the Controller cluster. This section discusses the steps to configure the Controller cluster using the API.

Getting the NSX Advanced Load Balancer Controller Cluster Configuration

To get the existing cluster configuration, send an API request as follows:

GET /api/cluster

The following is a sample output.

{
    url: "https://10.10.5.27/api/cluster",
    uuid: "cluster-005056ac9e91",
    name: "cluster-0-1",
    tenant_ref: "https://10.10.5.27/api/tenant/admin",
    virtual_ip: {
        type: "V4",
        addr: "10.10.5.27"
    },
    nodes: [
        {
            ip: {
                type: "V4",
                addr: "10.10.5.16"
            },
            vm_hostname: "node1.controller.local",
            vm_uuid: "005056ac9e91",
            name: "10.10.5.16",
        }
    ]
}

In this example, the cluster contains only a single member. When NSX Advanced Load Balancer is installed, the Controller created during installation is placed in a cluster as the primary Controller. The management IP address is configured as the cluster IP address.

Adding NSX Advanced Load Balancer Controller Nodes to the Cluster

To create a 3-node cluster, send a request such as the following to add two more Controller nodes to the cluster.

For controller-ip, specify the management IP address of the individual Controller node, not the IP address to be assigned to the cluster. The cluster IP is specified under virtual_ip.

PUT /api/cluster

The following is a PUT Data example.

{
    uuid: "cluster-005056ac9e91",
    name: "cluster-0-1",
    virtual_ip: {
        type: "V4",
        addr: "10.10.5.27"
    },
    nodes: [
        {
            ip: {
                type: "V4",
                addr: "10.10.5.16"
            },
            vm_hostname: "node1.controller.local",
            vm_uuid: "005056ac9e91",
            name: "10.10.5.16",
        },
        {
            ip: {
                type: "V4",
                addr: "10.10.5.15"
            },
            name: "10.10.5.15",
        },
        {
            ip: {
                type: "V4",
                addr: "10.10.5.17"
            },
            name: "10.10.5.17",
        }
    ]
}

Removing NSX Advanced Load Balancer Controller Nodes from the Cluster

To remove Controller nodes from the cluster, use a request such as the following.

PUT /api/cluster

The following is a PUT Data example.

{
    uuid: "cluster-005056ac9e91",
    name: "cluster-0-1",
    virtual_ip: {
        type: "V4",
        addr: "10.10.5.27"
    },
    nodes: [
        {
            ip: {
                type: "V4",
                addr: "10.10.5.16"
            },
            name: "10.10.5.16",
        }
    ]
}

Getting Runtime Information for the Cluster

The following request gets runtime information for the cluster.

The cluster is ready for operation when the cluster_state is CLUSTER_UP_HA_ACTIVE (for a 3-node cluster) or CLUSTER_UP_NO_HA (for a 1-node cluster).

This example shows CLUSTER_UP_HA_ACTIVE.

GET /api/cluster/runtime

{
    node_info: {
        uuid: "005056ac115e",
        mgmt_ip: "10.10.5.15",
        has_config: "True",
        ip: "node2.controller.local",
        vm_mor: "vm-54736",
        version: "16.1.1(9014) 2016-03-26 01:05:26 UTC",
        vm_uuid: "005056ac115e"
    },
    node_states: [
        {
            up_since: "2016-03-26 16:06:21",
            state: "CLUSTER_ACTIVE",
            role: "CLUSTER_LEADER",
            name: "10.10.5.15"
        },
        {
            up_since: "2016-03-26 16:07:08",
            state: "CLUSTER_ACTIVE",
            role: "CLUSTER_FOLLOWER",
            name: "10.10.5.17"
        },
        {
            up_since: "2016-03-26 16:07:31",
            state: "CLUSTER_ACTIVE",
            role: "CLUSTER_FOLLOWER",
            name: "10.10.5.16"
        }
    ],
    service_states: [],
        cluster_state: {
        up_since: "2016-03-26 16:06:21",
        progress: 100,
        state: "CLUSTER_UP_HA_ACTIVE"
    }
}