查询主备后端服务器组列表
功能介绍
主备后端服务器组列表。
接口约束
-
分页查询使用的参数为marker、limit、page_reverse。
-
marker和page_reverse只有和limit一起使用时才会生效,单独使用无效。
调用方法
请参见如何调用API。
URI
GET /v3/{project_id}/elb/master-slave-pools
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
project_id |
是 |
String |
参数解释:项目ID。获取方式请参见获取项目ID。 约束限制:不涉及 取值范围:长度为32个字符,由小写字母和数字组成。 默认取值:不涉及 |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
marker |
否 |
String |
参数解释:上一页最后一条记录的ID。 约束限制:
取值范围:不涉及 默认取值:不涉及 |
limit |
否 |
Integer |
参数解释:每页返回的个数。 约束限制:不涉及 取值范围:0-2000 默认取值:2000 |
page_reverse |
否 |
Boolean |
参数解释:是否反向查询。 约束限制:
取值范围:
默认取值:false |
description |
否 |
Array of strings |
参数解释:后端服务器组的描述信息。 支持多值查询,查询条件格式:description=xxx&description=xxx。 约束限制:不涉及 取值范围:不涉及 默认取值:不涉及 |
healthmonitor_id |
否 |
Array of strings |
参数解释:后端服务器组关联的健康检查的ID。 支持多值查询,查询条件格式:healthmonitor_id=xxx&healthmonitor_id=xxx。 约束限制:不涉及 取值范围:不涉及 默认取值:不涉及 |
id |
否 |
Array of strings |
参数解释:后端服务器组的ID。 支持多值查询,查询条件格式:id=xxx&id=xxx。 约束限制:不涉及 取值范围:不涉及 默认取值:不涉及 |
name |
否 |
Array of strings |
参数解释:后端服务器组的名称。 支持多值查询,查询条件格式:name=xxx&name=xxx。 约束限制:不涉及 取值范围:不涉及 默认取值:不涉及 |
loadbalancer_id |
否 |
Array of strings |
参数解释:后端服务器组绑定的负载均衡器ID。 支持多值查询,查询条件格式:loadbalancer_id=xxx&loadbalancer_id=xxx。 约束限制:不涉及 取值范围:不涉及 默认取值:不涉及 |
protocol |
否 |
Array of strings |
参数解释:后端服务器组的后端协议。 支持多值查询,查询条件格式:protocol=xxx&protocol=xxx。 约束限制:不涉及 取值范围:TCP、UDP、TLS、GRPC、HTTP、HTTPS和QUIC。 默认取值:不涉及 |
lb_algorithm |
否 |
Array of strings |
参数解释:后端服务器组的负载均衡算法。 支持多值查询,查询条件格式:lb_algorithm=xxx&lb_algorithm=xxx。 约束限制:不涉及 取值范围: 1、ROUND_ROBIN:加权轮询算法。 2、LEAST_CONNECTIONS:加权最少连接算法。 3、SOURCE_IP:源IP算法。 4、QUIC_CID:连接ID算法。 默认取值:不涉及 |
enterprise_project_id |
否 |
Array of strings |
参数解释:资源所属的企业项目ID。 支持多值查询,查询条件格式:enterprise_project_id=xxx&enterprise_project_id=xxx。 约束限制:
取值范围:不涉及 默认取值:不涉及 |
ip_version |
否 |
Array of strings |
参数解释:后端服务器组支持的IP版本。 支持多值查询,查询条件格式:ip_version=xxx&ip_version=xxx。 约束限制:不涉及 取值范围:不涉及 默认取值:不涉及 |
member_address |
否 |
Array of strings |
参数解释:后端服务器的IP地址。 支持多值查询,查询条件格式:member_address=xxx&member_address=xxx。 约束限制:仅用于查询条件,不作为响应参数字段。 取值范围:不涉及 默认取值:不涉及 |
member_device_id |
否 |
Array of strings |
参数解释:后端服务器对应的弹性云服务器的ID。 支持多值查询,查询条件格式:member_device_id=xxx&member_device_id=xxx。 约束限制:仅用于查询条件,不作为响应参数字段。 取值范围:不涉及 默认取值:不涉及 |
listener_id |
否 |
Array of strings |
参数解释:关联的监听器ID,包括通过l7policy关联的。 支持多值查询,查询条件格式:listener_id=xxx&listener_id=xxx。 约束限制:不涉及 取值范围:不涉及 默认取值:不涉及 |
member_instance_id |
否 |
Array of strings |
参数解释:后端服务器ID。 支持多值查询,查询条件格式:member_instance_id=xxx&member_instance_id=xxx。 约束限制:仅用于查询条件,不作为响应参数字段。 取值范围:不涉及 默认取值:不涉及 |
vpc_id |
否 |
Array of strings |
参数解释:后端服务器组关联的虚拟私有云的ID。 约束限制:不涉及 取值范围:不涉及 默认取值:不涉及 |
type |
否 |
Array of strings |
参数解释:后端服务器组的类型。 约束限制:不涉及 取值范围:
默认取值:不涉及 |
connection_drain |
否 |
Boolean |
参数解释:查询是否开启延迟注销的功能,查询条件格式:connection_drain=true或者connection_drain=false 约束限制:不涉及 取值范围:true 开启,false 不开启。 默认取值:不涉及 |
请求参数
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
X-Auth-Token |
是 |
String |
参数解释:IAM鉴权Token。 约束限制:不涉及 取值范围:不涉及 默认取值:不涉及 |
响应参数
状态码:200
参数 |
参数类型 |
描述 |
---|---|---|
request_id |
String |
参数解释:请求ID。 取值范围:由数字、小写字母和中划线(-)组成的字符串,自动生成。 |
page_info |
PageInfo object |
参数解释:分页信息。 |
pools |
Array of MasterSlavePool objects |
参数解释:后端服务器组列表。 |
参数 |
参数类型 |
描述 |
---|---|---|
previous_marker |
String |
参数解释:分页查询结果中第一条记录的ID。通常用于配合page_reverse=true查询上一页。 取值范围:不涉及 |
next_marker |
String |
参数解释:分页查询结果中最后一条记录的ID。通常用于查询下一页。 取值范围:不涉及 |
current_count |
Integer |
参数解释:当前页返回记录数。 取值范围:不涉及 |
参数 |
参数类型 |
描述 |
---|---|---|
description |
String |
参数解释:后端服务器组的描述信息。 取值范围:不涉及 |
id |
String |
参数解释:后端服务器组的ID。 取值范围:不涉及 |
lb_algorithm |
String |
参数解释:后端服务器组的负载均衡算法。 取值范围:不涉及
|
listeners |
Array of ListenerRef objects |
参数解释:后端服务器组关联的监听器ID列表。 |
loadbalancers |
Array of LoadBalancerRef objects |
参数解释:后端服务器组关联的负载均衡器ID列表。 |
members |
Array of MasterSlaveMember objects |
参数解释:后端服务器组中的后端服务器列表。 |
name |
String |
参数解释:后端服务器组的名称。 取值范围:不涉及 |
project_id |
String |
参数解释:后端服务器组所在的项目ID。 取值范围:不涉及 |
protocol |
String |
参数解释:后端服务器组的后端协议。 取值范围:不涉及TCP、UDP、QUIC、TLS。 |
session_persistence |
SessionPersistence object |
参数解释:会话持久性对象。 |
ip_version |
String |
参数解释:后端服务器组支持的IP版本。 取值范围:
|
created_at |
String |
参数解释:创建时间。格式:yyyy-MM-dd'T'HH:mm:ss'Z',UTC时区。 取值范围:不涉及 注意:独享型实例的历史数据以及共享型实例下的资源,不返回该字段。 |
updated_at |
String |
参数解释:更新时间。格式:yyyy-MM-dd'T'HH:mm:ss'Z',UTC时区。 取值范围:不涉及 注意:独享型实例的历史数据以及共享型实例下的资源,不返回该字段。 |
vpc_id |
String |
参数解释:后端服务器组关联的虚拟私有云的ID。 取值范围:不涉及 |
type |
String |
参数解释:后端服务器组的类型。 取值范围:不涉及
|
enterprise_project_id |
String |
参数解释:资源所属的企业项目ID。 取值范围:
|
healthmonitor |
MasterSlaveHealthMonitor object |
参数解释:后端服务器组的健康检查。 |
any_port_enable |
Boolean |
参数解释:后端是否开启全端口转发。开启后,后端服务器端口与前端监听器端口保持一致。关闭后,请求会转发给后端服务器protocol_port字段指定端口。取值:false 不开启,true 开启。 取值范围:不涉及 |
connection_drain |
ConnectionDrain object |
参数解释:后端服务器的延迟注销的功能配置。 以下场景会触发:
取值范围:不涉及 |
quic_cid_hash_strategy |
QuicCidHashStrategy object |
参数解释:主备后端服务器组基于部分DST CID的多径分发策略配置。 |
参数 |
参数类型 |
描述 |
---|---|---|
id |
String |
参数解释:后端服务器ID。 取值范围:不涉及 |
name |
String |
参数解释:后端服务器名称。 取值范围:不涉及 |
admin_state_up |
Boolean |
参数解释:后端服务器的管理状态。 虽然创建、更新请求支持该字段,但实际取值决定于后端服务器对应的弹性云服务器是否存在。若存在,该值为true,否则,该值为false。 取值范围:true、false。 |
subnet_cidr_id |
String |
参数解释:后端服务器所在子网的IPv4子网ID或IPv6子网ID。 若所属的LB的IP类型后端转发特性已开启,则该字段可以不传,表示添加跨VPC的后端服务器。此时address必须为私网IPv4地址,所在的pool的协议必须为UDP/TCP/TLS/HTTP/HTTPS/QUIC/GRPC。 取值范围:不涉及 |
protocol_port |
Integer |
参数解释:后端服务器业务端口。
说明:
在开启端口透传的pool下创建member传该字段不生效,可不传该字段。
|
address |
String |
参数解释:后端服务器对应的IP地址。 取值范围:不涉及 |
ip_version |
String |
参数解释:当前后端服务器的IP地址版本,由后端系统自动根据传入的address字段确定。 取值范围:v4、v6 |
device_owner |
String |
参数解释:设备所有者。 取值范围:不涉及
不支持该字段,请勿使用。 |
device_id |
String |
参数解释:关联的ECS ID,为空表示后端服务器未关联到ECS。 取值范围:不涉及 不支持该字段,请勿使用。 |
operating_status |
String |
参数解释:后端服务器的健康状态。 取值范围:不涉及
|
reason |
||
member_type |
String |
参数解释:后端服务器的类型。 取值范围:
|
instance_id |
String |
参数解释:member关联的实例ID。空表示member关联的实例为非真实设备 (如:跨VPC场景)。 取值范围:不涉及 |
role |
String |
参数解释:后端服务器的主备状态。 取值范围:不涉及 |
status |
Array of ListenerMemberInfo objects |
参数解释:后端服务器监听器粒度的的健康状态。 若绑定的监听器在该字段中,则以该字段中监听器对应的operating_status为准。 若绑定的监听器不在该字段中,则以外层的operating_status为准。 取值范围:不涉及 |
参数 |
参数类型 |
描述 |
---|---|---|
reason_code |
String |
参数解释:健康检查异常原因码。 取值范围:
|
expected_response |
String |
参数解释:健康检查预期响应状态码。支持HTTP,HTTPS,GRPC健康检查。只有reason_code为RESPONSE_MISMATCH时,支持非null取值。 取值范围:
|
healthcheck_response |
String |
参数解释:健康检查探测实际响应状态码。支持HTTP,HTTPS,GRPC健康检查。只有reason_code为RESPONSE_MISMATCH时,支持非null取值。 取值范围:
|
参数 |
参数类型 |
描述 |
---|---|---|
listener_id |
String |
参数解释:后端服务器关联的监听器ID。 取值范围:不涉及 |
operating_status |
String |
参数解释:后端服务器的健康状态。 取值范围:
|
参数 |
参数类型 |
描述 |
---|---|---|
cookie_name |
String |
参数解释:cookie名称。 取值范围:最大长度1024个字符。 |
type |
String |
参数解释:会话保持类型。 取值范围:SOURCE_IP、HTTP_COOKIE、APP_COOKIE。 |
persistence_timeout |
Integer |
参数解释:会话保持的时间。当type为APP_COOKIE时不生效。 取值范围:
|
参数 |
参数类型 |
描述 |
---|---|---|
admin_state_up |
Boolean |
参数解释:健康检查的管理状态。 取值范围:
|
delay |
Integer |
参数解释:健康检查间隔。 取值范围:1-50,单位:秒。 |
domain_name |
String |
参数解释:发送健康检查请求的域名。 取值范围:以数字或字母开头,只能包含数字、字母、’-’、’.’。 |
expected_codes |
String |
参数解释:期望响应状态码。 取值范围:
|
http_method |
String |
约束限制:HTTP请求方法。 取值范围:GET、HEAD、POST |
id |
String |
参数解释:健康检查ID 取值范围:不涉及 |
max_retries |
Integer |
参数解释:健康检查连续成功多少次后,将后端服务器的健康检查状态由OFFLINE判定为ONLINE。 取值范围:1-10 |
max_retries_down |
Integer |
参数解释:健康检查连续失败多少次后,将后端服务器的健康检查状态由ONLINE判定为OFFLINE。 取值范围:1-10 |
monitor_port |
Integer |
参数解释:健康检查端口号。 取值范围:1-65535 |
name |
String |
参数解释:健康检查名称。 取值范围:不涉及 |
timeout |
Integer |
参数解释:一次健康检查请求的超时时间。 取值范围:不涉及 |
type |
String |
参数解释:健康检查请求协议。 取值范围:TCP、UDP_CONNECT、HTTP、HTTPS。 |
url_path |
String |
参数解释:健康检查请求的请求路径。以"/"开头,默认为"/"。 取值范围:支持使用字母、数字和短划线(-)、正斜线(/)、半角句号(.)、百分号(%)、半角问号(?)、井号(#)和and(&)以及扩展字符集_;~!()*[]@$^:',+ |
请求示例
GET https://{ELB_Endpoint}/v3/99a3fff0d03c428eac3678da6a7d0f24/elb/master-slave-pools?limit=2
响应示例
状态码:200
操作正常返回。
{ "pools" : [ { "lb_algorithm" : "ROUND_ROBIN", "protocol" : "HTTP", "description" : "", "loadbalancers" : [ { "id" : "309a0f61-0b62-45f2-97d1-742f3434338e" } ], "project_id" : "99a3fff0d03c428eac3678da6a7d0f24", "session_persistence" : { "cookie_name" : "my_cookie", "type" : "APP_COOKIE", "persistence_timeout" : 1 }, "healthmonitor" : { "monitor_port" : null, "id" : "36ce7086-a496-4666-9064-5ba0e6840c75", "domain_name" : "", "name" : "My Healthmonitor", "max_retries" : 3, "max_retries_down" : 3, "admin_state_up" : true, "type" : "HTTP", "timeout" : 30, "delay" : 1, "http_method" : "get", "url_path" : "/", "expected_codes" : "200" }, "listeners" : [ ], "members" : [ { "admin_state_up" : true, "address" : "172.16.0.210", "protocol_port" : 80, "id" : "2e7b36d2-66c8-4825-bcd2-211d99978680", "operating_status" : "OFFLINE", "status" : [ ], "instance_id" : "", "device_id" : "", "device_owner" : "", "member_type" : "ip", "role" : "master", "ip_version" : "v4", "name" : "cx-test-master", "subnet_cidr_id" : "" }, { "admin_state_up" : true, "address" : "172.16.0.211", "protocol_port" : 81, "id" : "2e7b36d2-66c8-4823-bsd2-21sa199978681", "operating_status" : "OFFLINE", "status" : [ ], "instance_id" : "", "device_id" : "", "device_owner" : "", "member_type" : "ip", "role" : "slave", "ip_version" : "v4", "name" : "cx-test-slave", "subnet_cidr_id" : "" } ], "id" : "73bd4fe0-ffbb-4b56-aab4-4f26ddf7a103", "name" : "", "ip_version" : "v4", "type" : "ip", "vpc_id" : "", "created_at" : "2021-03-26T01:33:12Z", "updated_at" : "2021-03-26T01:33:12Z" }, { "lb_algorithm" : "SOURCE_IP", "protocol" : "TCP", "description" : "", "loadbalancers" : [ { "id" : "d9763e59-64b7-4e93-aec7-0ff7881ef9bc" } ], "project_id" : "99a3fff0d03c428eac3678da6a7d0f24", "session_persistence" : { "cookie_name" : "", "type" : "SOURCE_IP", "persistence_timeout" : 1 }, "healthmonitor" : { "monitor_port" : null, "id" : "36ce7086-a496-4666-9064-5ba0e6840c75", "domain_name" : "", "name" : "My Healthmonitor", "max_retries" : 3, "max_retries_down" : 3, "admin_state_up" : true, "type" : "HTTP", "timeout" : 30, "delay" : 1, "http_method" : "get", "url_path" : "/", "expected_codes" : "200" }, "listeners" : [ { "id" : "8d21db6f-b475-429e-a9cb-90439b0413b2" } ], "members" : [ { "admin_state_up" : true, "address" : "172.16.1.210", "protocol_port" : 83, "id" : "2e7b36d2-9997-4825-bcd2-211d9990439b", "operating_status" : "OFFLINE", "status" : [ ], "instance_id" : "", "device_id" : "", "device_owner" : "", "member_type" : "ip", "role" : "master", "ip_version" : "v4", "name" : "cx-test-master", "subnet_cidr_id" : "" }, { "admin_state_up" : true, "address" : "172.16.1.212", "protocol_port" : 82, "id" : "227b31d2-66c1-4823-bsd2-21sa199978213", "operating_status" : "OFFLINE", "status" : [ ], "instance_id" : "", "device_id" : "", "device_owner" : "", "member_type" : "ip", "role" : "slave", "ip_version" : "v4", "name" : "cx-test-slave", "subnet_cidr_id" : "" } ], "id" : "74db02d1-5711-4c77-b383-a450e2b93142", "name" : "pool_tcp_001", "ip_version" : "dualstack", "type" : "ip", "vpc_id" : "", "created_at" : "2021-03-26T01:33:12Z", "updated_at" : "2021-03-26T01:33:12Z" } ], "page_info" : { "next_marker" : "74db02d1-5711-4c77-b383-a450e2b93142", "previous_marker" : "73bd4fe0-ffbb-4b56-aab4-4f26ddf7a103", "current_count" : 2 }, "request_id" : "a1a7e852-1928-48f7-bbc9-ca8469898713" }
SDK代码示例
SDK代码示例如下。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
package com.huaweicloud.sdk.test; import com.huaweicloud.sdk.core.auth.ICredential; import com.huaweicloud.sdk.core.auth.BasicCredentials; import com.huaweicloud.sdk.core.exception.ConnectionException; import com.huaweicloud.sdk.core.exception.RequestTimeoutException; import com.huaweicloud.sdk.core.exception.ServiceResponseException; import com.huaweicloud.sdk.elb.v3.region.ElbRegion; import com.huaweicloud.sdk.elb.v3.*; import com.huaweicloud.sdk.elb.v3.model.*; public class ListMasterSlavePoolsSolution { public static void main(String[] args) { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment String ak = System.getenv("CLOUD_SDK_AK"); String sk = System.getenv("CLOUD_SDK_SK"); String projectId = "{project_id}"; ICredential auth = new BasicCredentials() .withProjectId(projectId) .withAk(ak) .withSk(sk); ElbClient client = ElbClient.newBuilder() .withCredential(auth) .withRegion(ElbRegion.valueOf("<YOUR REGION>")) .build(); ListMasterSlavePoolsRequest request = new ListMasterSlavePoolsRequest(); try { ListMasterSlavePoolsResponse response = client.listMasterSlavePools(request); System.out.println(response.toString()); } catch (ConnectionException e) { e.printStackTrace(); } catch (RequestTimeoutException e) { e.printStackTrace(); } catch (ServiceResponseException e) { e.printStackTrace(); System.out.println(e.getHttpStatusCode()); System.out.println(e.getRequestId()); System.out.println(e.getErrorCode()); System.out.println(e.getErrorMsg()); } } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# coding: utf-8 import os from huaweicloudsdkcore.auth.credentials import BasicCredentials from huaweicloudsdkelb.v3.region.elb_region import ElbRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdkelb.v3 import * if __name__ == "__main__": # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak = os.environ["CLOUD_SDK_AK"] sk = os.environ["CLOUD_SDK_SK"] projectId = "{project_id}" credentials = BasicCredentials(ak, sk, projectId) client = ElbClient.new_builder() \ .with_credentials(credentials) \ .with_region(ElbRegion.value_of("<YOUR REGION>")) \ .build() try: request = ListMasterSlavePoolsRequest() response = client.list_master_slave_pools(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" elb "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/elb/v3" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/elb/v3/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/elb/v3/region" ) func main() { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak := os.Getenv("CLOUD_SDK_AK") sk := os.Getenv("CLOUD_SDK_SK") projectId := "{project_id}" auth := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). WithProjectId(projectId). Build() client := elb.NewElbClient( elb.ElbClientBuilder(). WithRegion(region.ValueOf("<YOUR REGION>")). WithCredential(auth). Build()) request := &model.ListMasterSlavePoolsRequest{} response, err := client.ListMasterSlavePools(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } } |
更多编程语言的SDK代码示例,请参见API Explorer的代码示例页签,可生成自动对应的SDK代码示例。
状态码
状态码 |
描述 |
---|---|
200 |
操作正常返回。 |
错误码
请参见错误码。