Updated on 2023-12-18 GMT+08:00

Adding Backend Servers

API Format

Method

URI

Description

POST

/v2.0/lbaas/pools/{pool_id}/members

Adds backend servers that belong to a backend server group.

Constraints

  • Two backend servers in the same backend server group must have different IP addresses and ports.
  • The subnet specified during server creation and the subnet to which the virtual IP address belongs must be in the same VPC.
  • The value of admin_state_up must be true.

Procedure

  1. Set the request header. Set the header in Postman and place the obtained token in the header.

  2. Under Body, set the request body.

  3. Query the subnet ID and primary NIC IP address of the VM.

    The URL is as follows:

    GET https://{VPCEndpoint}/v2.0/ports?device_id={ecs_id}

    Obtain the values of subnet_id and ip_address of the port for which primary_interface is true from the response body. The following is an example of the response body:

    {
        "ports": [
            {
                "id": "4813697b-62ba-4f4b-90e5-13bbbdec7198",
                "name": "",
                "status": "ACTIVE",
                "admin_state_up": true,
                "fixed_ips": [
                    {
                        "subnet_id": "d97b6b89-6aa2-4636-a86b-132eb4eb566e",
                        "ip_address": "10.1.1.89"
                    }
                ],
                "mac_address": "fa:16:3e:cb:8d:0a",
                "network_id": "1b76b9c2-9b7e-4ced-81bd-d13f7389d7c9",
                "tenant_id": "04dd36f978800fe22f9bc00bea090736",
                "project_id": "04dd36f978800fe22f9bc00bea090736",
                "device_id": "f738c464-b5c2-45df-86c0-7f436620cd54",
                "device_owner": "compute:cn-north-4a",
                "security_groups": [
                    "7a233393-5be2-4dff-8360-1558dd950f6e"
                ],
                "extra_dhcp_opts": [],
                "allowed_address_pairs": [],
                "binding:vnic_type": "normal",
                "binding:vif_details": {},
                "binding:profile": {},
                "port_security_enabled": true,
                "created_at": "2019-11-19T09:28:38",
                "updated_at": "2019-11-19T09:28:39"
            },
            {
                "id": "94971c39-46f0-443a-85e8-31cb7497c78e",
                "name": "",
                "status": "ACTIVE",
                "admin_state_up": true,
                "fixed_ips": [
                    {
                        "subnet_id": "8d944cda-1f29-4035-9681-ad8c5117fbc5",
                        "ip_address": "192.168.0.11"
                    }
                ],
                "mac_address": "fa:16:3e:5c:d2:57",
                "network_id": "1b76b9c2-9b7e-4ced-81bd-d13f7389d7c9",
                "tenant_id": "04dd36f978800fe22f9bc00bea090736",
                "project_id": "04dd36f978800fe22f9bc00bea090736",
                "device_id": "f738c464-b5c2-45df-86c0-7f436620cd54",
                "device_owner": "compute:cn-north-4a",
                "security_groups": [
                    "a10dfc31-0055-4b84-b36e-1291b918125c",
                    "7a233393-5be2-4dff-8360-1558dd950f6e"
                ],
                "extra_dhcp_opts": [],
                "allowed_address_pairs": [],
                "binding:vnic_type": "normal",
                "binding:vif_details": {
                    "primary_interface": true
                },
                "binding:profile": {},
                "port_security_enabled": true,
                "created_at": "2019-11-12T17:17:51",
                "updated_at": "2019-11-12T17:17:51"
            }
        ]
    }

  4. Enter the URL.

    https://{ELBEndpoint}/v2.0/lbaas/pools/{pool_id}/members

  5. Send the request. Set the values of subnet_id and ip_address to these obtained in 3, select POST as the request method, and click Send.

    {
        "member": {
            "name": "member4j",
            "weight": 1,
            "admin_state_up": false,
            "subnet_id": "8d944cda-1f29-4035-9681-ad8c5117fbc5",
            "tenant_id": "0d0bf0e8fb564cc9abbe526dbdca9248",
            "address": "192.168.0.11",
            "protocol_port": 8080,
            "id": "97f18d73-e97d-434c-8cb7-3274a83dda73",
            "operating_status": "ONLINE"
        }
    }

Sample Code

Request body in 2

{
    "member": {
        "subnet_id": "8d944cda-1f29-4035-9681-ad8c5117fbc5",
        "protocol_port": "8080",
        "name": "member4j",
        "address": "192.168.0.11"
    }
}