tencent cloud

负载均衡

动态与公告
产品动态
产品公告
产品简介
产品概述
产品优势
使用场景
技术原理
产品对比
使用约束
Service Regions and Service Providers
购买指南
计费概述
计费项
CLB 资源包
购买方式
欠费说明
产品属性选择
快速入门
域名化负载均衡快速入门
负载均衡快速入门
IPv6 负载均衡快速入门
CentOS 下部署 Nginx
CentOS 下部署 Java Web
操作指南
负载均衡实例
负载均衡监听器
后端服务器
健康检查
证书管理
日志管理
监控告警
访问管理
传统型负载均衡
实践教程
部署证书到负载均衡(双向认证)
负载均衡开启 Gzip 配置及检测方法说明
HTTPS 转发配置入门指南
如何获取客户端真实 IP
负载均衡配置监控告警最佳实践
产品高可用说明
均衡算法选择与权重配置示例
配置 WAF 对负载均衡的监听域名进行 Web 安全防护
配置 IAP 对负载均衡的域名和路径的web访问进行身份验证
配置 IAP 对负载均衡的域名和路径的程序化访问进行身份验证
运维指南
客户端 timewait 过多解决方案
负载均衡HTTPS服务性能测试
压力测试常见问题
CLB 证书操作权限问题
故障处理
UDP 健康检查出现异常
API 文档
History
Introduction
API Category
Instance APIs
Listener APIs
Backend Service APIs
Target Group APIs
Redirection APIs
Other APIs
Classic CLB APIs
Load Balancing APIs
Making API Requests
Data Types
Error Codes
CLB API 2017
常见问题
计费相关
负载均衡配置相关
健康检查异常排查
HTTPS 相关
WS/WSS 协议支持相关
HTTP/2 协议支持相关
默认域名阻断提示
服务等级协议
联系我们
词汇表

Create CLB Listeners

PDF
聚焦模式
字号
最后更新时间: 2024-12-19 15:19:41

API Description

This API is used to create a CLB listener that provides the request forwarding rules, including parameters such as port, protocol, session persistence, and health check.
Domain name for API calls: lb.api.qcloud.com
The listener configuration rules are as follows:
A CLB port can only have one protocol in the same CLB instance.
Public network CLB listeners support HTTP, UDP, TCP, and HTTPS protocols, while private network CLB listeners only support UDP and TCP protocols.
Batch creation is not supported when creating HTTPS listeners.

Request Parameters

The list below contains only the API request parameters. Common parameters should be added when you call the API. For more information, see Common Request Parameters. The Action field for this API is CreateLoadBalancerListeners.
Parameter
Required
Type
Description
loadBalancerId
Yes
String
CLB instance ID, which can be queried via the DescribeLoadBalancers API.
listeners.n.loadBalancerPort
Yes
Int
Listening port of the CLB listener. Valid range: 1-65535. listeners is an array. You can create n listeners, and n is a subscript.
listeners.n.instancePort
Yes
Int
Listening port of CLB listener’s real server. Value range: 1-65535.
listeners.n.protocol
Yes
Int
Protocol type of the CLB listener. 1: HTTP; 2: TCP; 3: UDP; 4: HTTPS.
Public network CLB listeners support HTTP, UDP, TCP and HTTPS protocols;
Private network CLB listeners only support TCP and UDP protocols.
listeners.n.listenerName
No
String
Name of the CLB listener.
listeners.n.sessionExpire
No
Int
Session persistence duration of the CLB listener. Value range: 0 or 30-3600. Default value: 0.
listeners.n.healthSwitch
No
Int
Whether to enable the health check for CLB listeners. 1: enable; 0: disable. Default value: 1.
listeners.n.timeOut
No
Int
Response timeout of health check for the CLB listener, in seconds. Valid range: 2-60, default value: 2.
This parameter should be less than the check interval.
This parameter is currently unavailable to public network CLB listeners with HTTP or HTTPS protocol.
listeners.n.intervalTime
No
Int
Health check interval for the CLB listener, in seconds. Value range: 5-300. Default value: 5.
listeners.n.healthNum
No
Int
Healthy threshold of the CLB listener. Value range: 2-10. Default value: 3, indicating that if a forward is found healthy three consecutive times, it is considered to be normal.
llisteners.n.unhealthNum
No
Int
Unhealthy threshold of the CLB listener. Value range: 2-10. Default value: 3, indicating that if a forward is found unhealthy three consecutive times, it is considered to be abnormal.
listeners.n.httpHash
No
String
Forwarding method of the CLB listener. Only public CLB instances with HTTP or HTTPs listeners support this parameter. Valid values: wrr (weighted round robin), ip_hash (forwarding the hash of the source IP to the real server), least_conn (least connection).
Default value: wrr.
listeners.n.scheduler
No
String
Forwarding method of the CLB listener. Only public CLB instances with TCP or UDP listeners support this field. Valid values: wrr (weighted round robin), least_conn (least connection).
Default value: wrr.
listeners.n.httpCode
No
Int
Return code for health status of the HTTP or HTTPS listener of public network CLB instances. Valid range: 1-31. Default value: 31.
1 represents a return code of 1xx (healthy). 2 represents a return code of 2xx (healthy). 4 represents a return code of 3xx (healthy). 8 represents a return code of 4xx (healthy). 16 represents a return code of 5xx (healthy).
If there are multiple codes that can show the healthy status, enter the accumulated value corresponding to such codes.
listeners.n.httpCheckPath
No
String
Health check path for the HTTP or HTTPS listener of public network CLB instances. Default value: /. It must be started with /
listeners.n.SSLMode
No
String
SSL authentication type of the HTTPS listener of public network CLB instances.
unidirectional: one-way authentication; mutual: mutual authentication.
This parameter is required to a HTTPS listener.
listeners.n.certId
No
String
Server certificate ID. For HTTPS listeners, if this field is left empty, you must upload server certificate by specifying parameters including certContent, certKey, and certName.
listeners.n.certCaId
No
String
Client certificate ID. For HTTPS listeners, if SSLMode=mutual and this field is left empty, you must upload client certificate by specifying the certCaContent and certCaName parameters.
listeners.n.certCaContent
No
String
Content of the client certificate uploaded. For HTTPS listeners, if SSLMode=mutual and certCaId is left empty, this parameter must be passed in.
listeners.n.certCaName
No
String
Name of the client CA certificate uploaded. For HTTPS listeners, if SSLMode=mutual and certCaId is left empty, this parameter must be passed in.
listeners.n.certContent
No
String
Content of the server certificate uploaded. For HTTPS listeners, if certId is left empty, this parameter must be passed in.
listeners.n.certKey
No
String
Key of the server certificate uploaded. For HTTPS listeners, if certId is left empty, this parameter must be passed in.
listeners.n.certName
No
String
Name of the server certificate uploaded. For HTTPS listeners, if certId is left empty, this parameter must be passed in.

Response Parameters

Parameter Name
Type
Description
code
Int
Common error code. 0: success; other values: failure. For more information, see Common Error Codes.
message
String
API-related module error message description.
codeDesc
String
Error code. For a successful operation, "Success" is returned. For a failed operation, a message describing the failure is returned.
requestId
Int
Request task ID. The operation status can be queried via the DescribeLoadBalancersTaskResult API.
listenerIds
Array
Listener ID array.

Example

Request
https://lb.api.qcloud.com/v2/index.php?Action=CreateLoadBalancerListeners
&loadBalancerId=lb-abcdefgh
&listeners.0.loadBalancerPort=443
&listeners.0.instancePort=443
&listeners.0.protocol=4
&listeners.0.SSLMode=mutual
&listeners.0.certName=myCert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9jcmxzMi53
b3NpZ24uY24vY2EyZzItc2VydmVyMS1mcmVlLmNybDBOBgNVHREERzBFggpnLmYt
eGouY29tghBzY2hvbGFyLmYteGouY29tggt5dC5mLXhqLmNvbYILZmIuZi14ai5j
b22CC3R3LmYteGouY29tME8GA1UdIARIMEYwCAYGZ4EMAQIBMDoGCysGAQQBgptR
AQECMCswKQYIKwYBBQUHAgEWHWh0dHA6Ly93d3cud29zaWduLmNvbS9wb2xpY3kv
MA0GCSqGSIb3DQEBCwUAA4IBAQCJSd/1xmxwnT/TtKvvxTvDnkCpfsFYVmqiHB/Z
rXiMdgobUOfF7C8kcBCTqSQAXZF3fjJ1KyhNulvKOffzGGYp+rMwoTAmfaNLUxD/
X9gPLxZCiysDBQ1BLe16k4aKUHIOmqQNF1MD/8hOZBxjevctKaXc4Xqm2gxJLxDH
RoY3HKZcdB6t/x7YJU640wvaFqDqIgR6Pc74YjtLrNjkXcf/IQU7c2yjZt9NIGeS
OTku5DmFasRf04tmE7naB+wkUZOwAqGK8CESNS11BYZjO/M4G/ALS8zCpShUy89H
hYiYAG5jdNI4vyWwaU4428nG3YvKzlTOpCaowqgbyCcqmtAT
-----END CERTIFICATE-----
&listeners.0.certKey=-----BEGIN RSA PRIVATE KEY-----
your own key
-----END RSA PRIVATE KEY-----
&listeners.0.certCaContent=-----BEGIN CERTIFICATE-----
MIIEPDCCAySgAwIBAgIJAJiHd00fZNxoMA0GCSqGSIb3DQEBBQUAMHExCzAJBgNV
BAYTAkNOMQswCQYDVQQIEwJHUzELMAkGA1UEBxMCU1oxDTALBgNVBAoTBFhYWFgx
DjAMBgNVBAsTBVhYWFhYMQ4wDAYDVQQDEwVBQUFBQTEZMBcGCSqGSIb3DQEJARYK
d3d3QHFxLmNvbTAeFw0xNjA4MTExMTUyNTZaFw0xNzA4MDIxMTUyNTZaMHExCzAJ
BgNVBAYTAkNOMQswCQYDVQQIEwJHUzELMAkGA1UEBxMCU1oxDTALBgNVBAoTBFhY
WFgxDjAMB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yq0QNg0o15edx+GfbY5FJbgXf3FER+NgMB
wPeJ62izpROBQvXYNb3e72gM1xCAlgD+MBpNeGlx56g=
-----END CERTIFICATE-----
&listeners.0.certCaName=myCertCaName
Response
{
"code": 0,
"message": "",
"codeDesc": "Success",
"requestId": 28557,
"listenerIds": [
"lbl-hox8i4q0"
]
}

帮助和支持

本页内容是否解决了您的问题?

填写满意度调查问卷,共创更好文档体验。

文档反馈