创建HTTP监听。
接口说明
注意事项
新建的监听的状态为 stopped。创建完成后,调用 StartLoadBalancerListener 接口启动监听来转发流量。
前提条件
您已经创建传统型负载均衡,具体操作,请参见 CreateLoadBalancer 。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
调试
授权信息
|
操作 |
访问级别 |
资源类型 |
条件关键字 |
关联操作 |
|
slb:CreateLoadBalancerHTTPListener |
create |
*acl
*loadbalancer
|
|
无 |
请求参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| RegionId |
string |
否 |
传统型负载均衡实例的地域 ID。 您可以从地域和可用区列表或通过调用 DescribeRegions 接口获取地域 ID。 |
cn-hangzhou |
| LoadBalancerId |
string |
是 |
传统型负载均衡实例 ID。 |
lb-bp1c9vixxjh92q83tw***** |
| Bandwidth |
integer |
否 |
监听的带宽峰值,单位:Mbps。取值:
|
-1 |
| ListenerPort |
integer |
是 |
实例前端使用的端口。 取值:1~65535。 |
80 |
| BackendServerPort |
integer |
否 |
实例后端使用的端口。 取值:1~65535。 说明
如果不使用虚拟服务器组(不指定 VServerGroupId 参数),则该参数必选。 |
80 |
| XForwardedFor |
string |
否 |
是否开启通过
|
on |
| Scheduler |
string |
否 |
调度算法。取值:
|
wrr |
| StickySession |
string |
否 |
是否开启会话保持。取值:
|
off |
| StickySessionType |
string |
否 |
Cookie 处理方式。取值:
说明
当 StickySession 值为 on 时,必须指定该参数。 |
insert |
| Tag |
array<object> |
否 |
标签列表。 |
|
|
object |
否 |
标签列表。 |
||
| Key |
string |
否 |
监听的标签键。N 的取值范围:1~20。一旦传入该值,则不允许为空字符串。最多支持 128 个字符,不能以 |
TestKey |
| Value |
string |
否 |
监听的标签值。N 的取值范围:1~20。一旦传入该值,可以为空字符串。最多支持 128 个字符,不能以 |
TestValue |
| CookieTimeout |
integer |
否 |
Cookie 超时时间。单位:秒。 取值:1~86400。 说明
当 StickySession 为 on 且 StickySessionType 为 insert 时,该参数必选。 |
500 |
| Cookie |
string |
否 |
服务器上配置的 Cookie。 长度为 1~200 个字符,只能包含 ASCII 英文字母和数字字符,不能包含半角逗号(,)、半角分号(;)或空格,也不能以美元符号($)开头。 说明
当 StickySession 为 on 且 StickySessionType 为 server 时,该参数必选。 |
testCookie |
| HealthCheck |
string |
是 |
是否开启健康检查。取值:
|
on |
| HealthCheckMethod |
string |
否 |
监听 HTTP 类型健康检查的健康检查方法。取值:head 或 get。 说明
HealthCheck 值为 on 时才会有效。 |
get |
| HealthCheckDomain |
string |
否 |
用于健康检查的域名,取值:
说明
在 HealthCheck 值为 on 时才会有效。 |
172.16.*.*/12 |
| HealthCheckURI |
string |
否 |
用于健康检查的 URI。 长度限制为 1~80 个字符,只能使用字母、数字和短划线(-)、正斜线(/)、半角句号(.)、百分号(%)、半角问号(?)、井号(#)和 and(&)这些字符。URI 不能只为正斜线(/),但必须以正斜线(/)开头。 说明
在 HealthCheck 值为 on 时才会有效。 |
/test/index.html |
| HealthyThreshold |
integer |
否 |
健康检查连续成功多少次后,将后端服务器的健康检查状态由失败判定为成功。 取值:2~10。 说明
在 HealthCheck 值为 on 时才会有效。 |
4 |
| UnhealthyThreshold |
integer |
否 |
健康检查连续失败多少次后,将后端服务器的健康检查状态由成功判定为失败。 取值:2~10。 说明
在 HealthCheck 值为 on 时才会有效。 |
4 |
| HealthCheckTimeout |
integer |
否 |
接收来自运行状况检查的响应需要等待的时间。如果后端 ECS 在指定的时间内没有正确响应,则判定为健康检查失败。单位:秒。 取值:1~300。 说明
在 HealthCheck 值为 on 时才会有效。 |
3 |
| HealthCheckConnectPort |
integer |
否 |
健康检查的后端服务器的端口。 取值: 1~65535。 说明
在 HealthCheck 值为 on 时才会有效。 |
80 |
| HealthCheckInterval |
integer |
否 |
健康检查的时间间隔。单位:秒。 取值: 1~50。 说明
在 HealthCheck 值为 on 时才会有效。 |
5 |
| HealthCheckHttpCode |
string |
否 |
健康检查正常的 HTTP 状态码,多个状态码用逗号分隔。 取值:http_2xx(默认值)、http_3xx、http_4xx或http_5xx。 说明
在 HealthCheck 值为 on 时才会有效。 |
http_2xx |
| VServerGroupId |
string |
否 |
虚拟服务器组 ID。 |
rsp-cige6j***** |
| XForwardedFor_SLBIP |
string |
否 |
是否通过
|
on |
| XForwardedFor_SLBID |
string |
否 |
是否通过
|
on |
| XForwardedFor_proto |
string |
否 |
是否通过
|
on |
| Gzip |
string |
否 |
是否开启
|
on |
| AclId |
string |
否 |
监听绑定的访问策略组 ID。 说明
当 AclStatus 参数的值为 on 时,该参数必选。 |
acl-uf60jw****** |
| AclType |
string |
否 |
访问控制类型。取值:
说明
当 AclStatus 参数的值为 on 时,该参数有效。 |
white |
| AclStatus |
string |
否 |
是否开启访问控制功能。取值:
|
off |
| Description |
string |
否 |
自定义监听名称。 长度限制为 1~256 个字符,支持中文、字母、数字、短划线(-)、正斜线(/)、半角句号(.)和下划线(_)。 |
HTTP_443 |
| ListenerForward |
string |
否 |
是否开启 HTTP 至 HTTPS 的转发。取值:
|
off |
| ForwardPort |
integer |
否 |
HTTP 至 HTTPS 的监听转发端口。 |
443 |
| IdleTimeout |
integer |
否 |
指定连接空闲超时时间。单位:秒。 默认值为 15,取值范围:1~60。 在超时时间内一直没有访问请求,负载均衡会暂时中断当前连接,直到一下次请求来临时重新建立新的连接。 |
3 |
| RequestTimeout |
integer |
否 |
指定请求超时时间。单位:秒。 默认值为 60,取值范围为 1~180。 在超时时间内后端服务器一直没有响应,负载均衡将放弃等待,给客户端返回 |
6 |
| XForwardedFor_SLBPORT |
string |
否 |
是否通过
|
off |
| XForwardedFor_ClientSrcPort |
string |
否 |
是否通过
|
off |
返回参数
|
名称 |
类型 |
描述 |
示例值 |
|
object |
|||
| RequestId |
string |
请求 ID。 |
CEF72CEB-54B6-4AE8-B225-F876FF7BA984 |
示例
正常返回示例
JSON格式
{
"RequestId": "CEF72CEB-54B6-4AE8-B225-F876FF7BA984"
}
错误码
|
HTTP status code |
错误码 |
错误信息 |
描述 |
|---|---|---|---|
| 400 | InvalidParameter.RegionNotSupport | The region does not support the parameter: %s. | 当前区域不支持指定参数。 |
| 400 | IpVersionConflict | The ip version of this LoadBalancer and the Acl is conflict. | 指定负载均衡的IP版本与ACL支持的IP类型冲突。 |
| 400 | InvalidParameter | The specified ListenerPort or ForwardPort is invalid. | 指定的ListenerPort or ForwardPort无效。请检查参数约束,并在修改后重试。 |
| 400 | ListenerForwardNotSupport | X-Forward-For is not supported to a ipv6 instance. | Ipv6负载均衡实例不支持X-Forward-For。 |
| 400 | InvalidParameter.IdleTimeout | The specified IdleTimeout exceeds the limit. | 指定的IdleTimeout无效。请检查参数约束,并在修改后重试。 |
| 400 | InvalidParameter.RequestTimeout | The specified RequestTimeout exceeds the limit. | 指定的RequestTimeout无效。请检查参数约束,并在修改后重试。 |
| 400 | ListenerProcessing | A previous configuration of the listener is pending,please try again later. | 当前监听正在配置中,请稍后重试。 |
| 400 | InvalidParameter.ListenerPortConflict | There is conflict listener port exists. | 指定的监听端口已存在。 |
| 400 | ResourceNotAvailible.HttpListener | The specified Zone did not have enough resource. | 指定可用区资源不足。 |
| 400 | AclNotExist | Acl does not exist. | 指定的Acl不存在。 |
| 400 | OperationUnsupported.CreateLoadBalancerLayer7Listener | The slb instance does not support create HTTP or HTTPS listener. | 当前负载均衡实例不支持创建HTTP或者HTTPS类型的监听。 |
| 400 | InvalidParameter.VServerGroupId | The MasterSlaveServerGroup can not be attached to HTTP or HTTPS listener. | HTTP或HTTPS监听不支持挂载主备服务器组。 |
| 400 | MissingParam.HealthCheckDomain | The HealthCheckDomain is required when HealthCheckHttpVersion is http1.1. | 参数HealthCheckDomain缺失。 |
| 400 | InvalidParameter.HealthCheckHttpVersion | The param HealthCheckHttpVersion is invalid. | 指定的HealthCheckHttpVersion无效。请检查参数约束,并在修改后重试。 |
| 400 | Duplicated.AclEntry | %s. | %s |
| 400 | OperationFailed.InsufficientResources | The loadbalancer does not support this operation because of insufficient resources. | 操作失败,原因是由于资源不足,负载均衡器不支持此操作。 |
| 400 | InvalidParameter.ForwardCode | The specified ForwardCode is invalid. | 指定的ForwardCode无效。请检查参数约束,并在修改后重试。 |
| 400 | LbNotSupportTcpssl | You cannot create a TCP SSL type listener for the specified load balancer. | 指定的实例不支持创建tcpssl类型的监听。 |
| 400 | LbSupportTcpsslOnly | The specified load balancer supports TCP SSL type listener only. | 指定的实例只支持创建tcpssl类型的监听。 |
| 400 | ListenerNotSupportRule | You cannot create a rule for the specified listener. | 指定的监听不支持创建转发规则。 |
| 400 | Mismatch.SlbSpecTypeAndListenerProtocol | The SlbSpecType and ListenerProtocol are mismatched. | 实例规格类型和监听类型不匹配。 |
| 400 | InvalidParam.TagValue | %s. | |
| 400 | InvalidParam.TagKey | %s. | |
| 400 | SizeLimitExceeded.Tag | %s. | |
| 400 | MissingParam.TagKey | The param MissingParam.TagKey is missing. | |
| 400 | AclListenerOverLimit | This acl has reached the limit of binding to listeners. | 指定Acl可关联监听数量已达到配额上限。 |
| 400 | QuotaLimitExceeds.AclAttachedToListener | The number of Acl bound listeners has reached the quota limit | Acl绑定监听数已达到配额上限。 |
| 400 | QuotaLimitExceeds.TotalAclEntry | The number of Acl entries has reached the quota limit. | Acl条目数已达到配额上限。 |
| 400 | QuotaLimitExceeds.AclListenerOverLimit | This acl has reached the limit of binding to listeners. | 指定Acl可关联监听数量已达到配额上限。 |
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。