Halaman ini belum tersedia dalam bahasa lokal Anda. Kami berusaha keras untuk menambahkan lebih banyak versi bahasa. Terima kasih atas dukungan Anda.

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Adding a Backend Server Group

Updated on 2022-01-25 GMT+08:00

Function

This API is used to add a backend server group. After multiple backend servers are added to a backend server group, requests are distributed among backend servers based on the load balancing algorithm configured for the backend server group and the weight set for each backend server.

Constraints

  • If parameter session-persistence is configured, parameter cookie_name is available only when the value of type is APP_COOKIE.

URI

POST /v2/{project_id}/elb/pools

Table 1 Parameter description

Parameter

Mandatory

Type

Description

project_id

Yes

String

Specifies the project ID.

Request

Table 2 Parameter description

Parameter

Mandatory

Type

Description

pool

Yes

Object

Specifies the backend server group. For details, see Table 3.

Table 3 pool parameter description

Parameter

Mandatory

Type

Description

tenant_id

No

String

Specifies the ID of the project where the backend server group is used.

The value must be the same as the value of project_id in the token.

The value contains a maximum of 255 characters.

name

No

String

Specifies the name of the backend server group.

The value contains a maximum of 255 characters.

description

No

String

Provides supplementary information about the backend server group.

The value contains a maximum of 255 characters.

protocol

Yes

String

Specifies the protocol that the backend server group uses to receive requests.

TCP, UDP, and HTTP are supported.

When a backend server group is associated with a listener, the relationships between the protocol used by the listener and the protocol of the backend server group are as follows:

  • When the protocol used by the listener is UDP, the protocol of the backend server group must be UDP.
  • When the protocol used by the listener is TCP, the protocol of the backend server group must be TCP.
  • When the protocol used by the listener is HTTP or TERMINATED_HTTPS, the protocol of the backend server group must be HTTP.

lb_algorithm

Yes

String

Specifies the load balancing algorithm of the backend server group.

The value range varies depending on the protocol of the backend server group:
  • ROUND_ROBIN: indicates the weighted round robin algorithm.
  • LEAST_CONNECTIONS: indicates the weighted least connections algorithm.
  • SOURCE_IP: indicates the source IP hash algorithm.

When the value is SOURCE_IP, the weights of backend servers in the server group are invalid.

admin_state_up

No

Boolean

Specifies the administrative status of the backend server group.

This parameter is reserved. The default value is true.

listener_id

No

String

Specifies the ID of the listener associated with the backend server group.

Specify either listener_id or loadbalancer_id, or both of them.

loadbalancer_id

No

String

Specifies the ID of the load balancer associated with the backend server group.

Specify either listener_id or loadbalancer_id, or both of them.

session_persistence

No

Object

Specifies the sticky session timeout duration in minutes. For details, see Table 4.

If the value is null, the sticky session feature is disabled.

Table 4 session_persistence parameter description

Parameter

Mandatory

Type

Description

type

Yes

String

Specifies the sticky session type.

The value range varies depending on the protocol of the backend server group:
  • SOURCE_IP: Requests are distributed based on the client's IP address. Requests from the same IP address are sent to the same backend server.
  • HTTP_COOKIE: When the client sends a request for the first time, the load balancer automatically generates a cookie and inserts the cookie into the response message. Subsequent requests are sent to the backend server that processes the first request.
  • APP_COOKIE: When the client sends a request for the first time, the backend server that receives the request generates a cookie and inserts the cookie into the response message. Subsequent requests are sent to this backend server.

When the protocol of the backend server group is TCP, only SOURCE_IP takes effect. When the protocol of the backend server group is HTTP, only HTTP_COOKIE or APP_COOKIE takes effect.

cookie_name

No

String

Specifies the cookie name.

This parameter is mandatory when the sticky session type is APP_COOKIE.

persistence_timeout

No

Integer

Specifies the sticky session timeout duration in minutes.

This parameter is invalid when type is set to APP_COOKIE.

The value range varies depending on the protocol of the backend server group:
  • When the protocol of the backend server group is TCP or UDP, the value ranges from 1 to 60.
  • When the protocol of the backend server group is HTTP, the value ranges from 1 to 1440.

Response

Table 5 Parameter description

Parameter

Type

Description

pool

Object

Specifies the backend server group. For details, see Table 6.

Table 6 pool parameter description

Parameter

Type

Description

id

String

Specifies the ID of the backend server group.

tenant_id

String

Specifies the ID of the project where the backend server group is used.

The value contains a maximum of 255 characters.

name

String

Specifies the name of the backend server group.

The value contains a maximum of 255 characters.

description

String

Provides supplementary information about the backend server group.

The value contains a maximum of 255 characters.

protocol

String

Specifies the protocol that the backend server group uses to receive requests.

TCP, UDP, and HTTP are supported.

When a backend server group is associated with a listener, the relationships between the protocol used by the listener and the protocol of the backend server group are as follows:

  • When the protocol used by the listener is UDP, the protocol of the backend server group must be UDP.
  • When the protocol used by the listener is TCP, the protocol of the backend server group must be TCP.
  • When the protocol used by the listener is HTTP or TERMINATED_HTTPS, the protocol of the backend server group must be HTTP.

lb_algorithm

String

Specifies the load balancing algorithm of the backend server group.

The value range varies depending on the protocol of the backend server group:
  • ROUND_ROBIN: indicates the weighted round robin algorithm.
  • LEAST_CONNECTIONS: indicates the weighted least connections algorithm.
  • SOURCE_IP: indicates the source IP hash algorithm. When the value is SOURCE_IP, the weights of backend servers in the server group are invalid.

members

Array

Lists the IDs of backend servers in the backend server group. For details, see Table 7.

healthmonitor_id

String

Specifies the ID of the health check configured for the backend server group.

admin_state_up

Boolean

Specifies the administrative status of the backend server group.

This parameter is reserved. The default value is true.

listeners

Array

Lists the IDs of listeners associated with the backend server group. For details, see Table 8.

loadbalancers

Array

Lists the IDs of load balancers associated with the backend server group. For details, see Table 9.

session_persistence

Object

Specifies whether to enable the sticky session feature. For details, see Table 10.

Once the sticky session feature is enabled, requests from the same client are sent to the same backend server within the specified period.

When this feature is disabled, the parameter value is null.

Table 7 members parameter description

Parameter

Type

Description

id

String

Specifies the ID of the associated backend server.

Table 8 listeners parameter description

Parameter

Type

Description

id

String

Specifies the ID of the associated backend server group.

Table 9 loadbalancers parameter description

Parameter

Type

Description

id

String

Specifies the ID of the associated load balancer.

Table 10 session_persistence parameter description

Parameter

Mandatory

Type

Description

type

Yes

String

Specifies the sticky session type.

The value range varies depending on the protocol of the backend server group:
  • SOURCE_IP: Requests are distributed based on the client's IP address. Requests from the same IP address are sent to the same backend server.
  • HTTP_COOKIE: When the client sends a request for the first time, the load balancer automatically generates a cookie and inserts the cookie into the response message. Subsequent requests are sent to the backend server that processes the first request.
  • APP_COOKIE: When the client sends a request for the first time, the backend server that receives the request generates a cookie and inserts the cookie into the response message. Subsequent requests are sent to this backend server.

When the protocol of the backend server group is TCP, only SOURCE_IP takes effect. When the protocol of the backend server group is HTTP, only HTTP_COOKIE or APP_COOKIE takes effect.

cookie_name

No

String

Specifies the cookie name.

This parameter is mandatory when the sticky session type is APP_COOKIE.

persistence_timeout

No

Integer

Specifies the sticky session timeout duration in minutes.

This parameter is invalid when type is set to APP_COOKIE.

The value range varies depending on the protocol of the backend server group:
  • When the protocol of the backend server group is TCP or UDP, the value ranges from 1 to 60.
  • When the protocol of the backend server group is HTTP, the value ranges from 1 to 1440.

Example Request

  • Example request 1
    • Step 1: Query the subnet ID and IP address using the server ID. device_id in the request indicates the server ID. Obtain the values of subnet_id and ip_address of the primary NIC (the port for which primary_interface is true) in the response body.
      GET https://{VPCEndpoint}/v2.0/ports?device_id=f738c464-b5c2-45df-86c0-7f436620cd54

      Example response

      {
          "ports": [
              {
                  "id": "94971c39-46f0-443a-85e8-31cb7497c78e",
                  "name": "",
                  "status": "ACTIVE",
                  "admin_state_up": true,
                  "fixed_ips": [
                      {
                          "subnet_id": "33d8b01a-bbe6-41f4-bc45-78a1d284d503",
                          "ip_address": "192.168.44.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"
              }
          ]
      }
    • Step 2: Add a backend server group with the sticky session feature disabled.
      POST https://{Endpoint}/v2/601240b9c5c94059b63d484c92cfe308/elb/pools
      
      {
          "pool": {
              "lb_algorithm":"ROUND_ROBIN",
              "loadbalancer_id": "63ad9dfe-4750-479f-9630-ada43ccc8117",
              "protocol":"HTTP"
          }
      }
  • Example request 2: Adding a backend server group with the value of type set to APP_COOKIE
    POST https://{Endpoint}/v2/145483a5107745e9b3d80f956713e6a3/elb/pools
    
    {
      "pool": {
        "lb_algorithm": "ROUND_ROBIN",
        "loadbalancer_id": "370fb112-e920-486a-b051-1d0d30704dd3",
        "protocol": "HTTP",
        "session_persistence": {
          "cookie_name": "my_cookie",
          "type": "APP_COOKIE",
          "persistence_timeout": 1
        },
        "admin_state_up": true
      }
    }
  • Example request 3: Adding an HTTP backend server group with the value of type set to HTTP_COOKIE
    POST https://{Endpoint}/v2/601240b9c5c94059b63d484c92cfe308/elb/pools 
    
    {
        "pool": {
            "lb_algorithm":"ROUND_ROBIN",
            "loadbalancer_id": "63ad9dfe-4750-479f-9630-ada43ccc8117",
            "protocol":"HTTP",
            "session_persistence":{
            	"type":"HTTP_COOKIE"
            }
        }
    }

Example Response

  • Example response 1
    {
        "pool": {
            "lb_algorithm": "ROUND_ROBIN",
            "protocol": "HTTP",
            "description": "",
            "admin_state_up": true,
            "loadbalancers": [
                {
                    "id": "63ad9dfe-4750-479f-9630-ada43ccc8117"
                }
            ],
            "tenant_id": "601240b9c5c94059b63d484c92cfe308",
            "session_persistence": null,
            "healthmonitor_id": null,
            "listeners": [],
            "members": [],
            "id": "4e496951-befb-47bf-9573-c1cd11825c07",
            "name": ""
        }
    }
  • Example response 2
    {
      "pool": {
        "lb_algorithm": "ROUND_ROBIN",
        "protocol": "HTTP",
        "description": "",
        "admin_state_up": true,
        "loadbalancers": [
          {
            "id": "6b041b9e-976b-40ba-b075-375be6110b53"
          }
        ],
        "tenant_id": "145483a5107745e9b3d80f956713e6a3",
        "session_persistence": {
          "cookie_name": "my_cookie",
          "type": "APP_COOKIE",
          "persistence_timeout": 1
        },
        "healthmonitor_id": null,
        "listeners": [
          {
            "id": "370fb112-e920-486a-b051-1d0d30704dd3"
          }
        ],
        "members": [],
        "id": "307f8968-9474-4d0c-8434-66be09dabcc1",
        "name": ""
      }
    } 
  • Example response 3
    {
        "pool": {
            "lb_algorithm": "ROUND_ROBIN",
            "protocol": "HTTP",
            "description": "",
            "admin_state_up": true,
            "loadbalancers": [
                {
                    "id": "63ad9dfe-4750-479f-9630-ada43ccc8117"
                }
            ],
            "tenant_id": "601240b9c5c94059b63d484c92cfe308",
            "session_persistence": {
                "persistence_timeout": 1440,
                "cookie_name": null,
                "type": "HTTP_COOKIE"
            },
            "healthmonitor_id": null,
            "listeners": [],
            "members": [],
            "id": "d46eab56-d76b-4cd3-8952-3c3c4cf113aa",
            "name": ""
        }
    }

Status Code

For details, see HTTP Status Codes of Load Balancers.

Kami menggunakan cookie untuk meningkatkan kualitas situs kami dan pengalaman Anda. Dengan melanjutkan penelusuran di situs kami berarti Anda menerima kebijakan cookie kami. Cari tahu selengkapnya

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback