调用CreateLoadBalancerUDPListener接口创建UDP监听。

经典网络的负载均衡的UDP协议监听暂不支持查看源地址。

说明 新建的监听的状态为stopped。创建完成后,调用StartLoadBalancerListener接口启动监听来转发流量。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

请求参数

名称 类型 是否必选 示例值 描述
RegionId String cn-hangzhou

传统型负载均衡实例的地域ID。

Action String CreateLoadBalancerUDPListener

系统规定参数。取值:CreateLoadBalancerUDPListener

LoadBalancerId String lb-bp1ygod3yctvg1y7****

传统型负载均衡实例的ID。

ListenerPort Integer 80

传统型负载均衡实例前端使用的端口。

取值范围:1~65535

BackendServerPort Integer 80

传统型负载均衡实例后端使用的端口。

取值范围:1~65535

如果不使用虚拟服务器组(不指定VServerGroupId),则该参数必选。

Bandwidth Integer -1

监听的带宽峰值。单位:Mbps。取值:

-1:对于按流量计费的公网负载均衡实例,可以将带宽峰值设置为-1,即不限制带宽峰值。

Scheduler String wrr

调度算法。取值:

  • wrr(默认值):权重值越高的后端服务器,被轮询到的次数(概率)也越高。
  • rr:按照访问顺序依次将外部请求依序分发到后端服务器。
  • sch:基于源IP地址的一致性hash,相同的源地址会调度到相同的后端服务器。
  • tch:基于四元组的一致性hash(源IP+目的IP+源端口+目的端口),相同的流会调度到相同的后端服务器。
  • qch:基于QUIC Connection ID一致性hash,相同的QUIC Connection ID会调度到相同的后端服务器。

仅性能保障型实例支持sch、 tch和qch一致性hash算法。

HealthyThreshold Integer 4

健康检查连续成功多少次后,将后端服务器的健康检查状态由fail判定为success

取值范围:2~10

UnhealthyThreshold Integer 4

健康检查连续失败多少次后,将后端服务器的健康检查状态由success判定为fail

取值范围:2~10

HealthCheckConnectTimeout Integer 100

接收来自运行状况检查的响应需要等待的时间。

如果后端ECS在指定的时间内没有正确响应,则判定为健康检查失败。单位:秒。

取值范围:1~300

HealthCheckConnectPort Integer 80

健康检查使用的端口。

取值范围:1~65535

不设置此参数时,表示使用后端服务端口(BackendServerPort)。

healthCheckInterval Integer 3

健康检查的时间间隔。单位:秒。

取值范围:1~50

healthCheckReq String hello

UDP监听健康检查的请求字符串,只允许包含字母、数字,最大长度限制为64个字符。

healthCheckExp String ok

UDP监听健康检查的响应字符串,只允许包含字母、数字,最大长度限制为64个字符。

VServerGroupId String rsp-cige6j8****

虚拟服务器组ID。

MasterSlaveServerGroupId String rsp-0bfucwu****

主备服务器组ID。

说明 虚拟服务器组ID和主备服务器组ID只能选择一个。
AclId String 123

监听绑定的访问策略组ID。

AclStatus参数的值为on时,该参数必选。

AclType String white

访问控制类型,取值:

  • white:仅转发来自所选访问控制策略组中设置的IP地址或地址段的请求,白名单适用于应用只允许特定IP访问的场景。设置白名单存在一定业务风险,一旦设置白名单,就只有白名单中的IP可以访问负载均衡监听。

    如果开启了白名单访问,但访问策略组中没有添加任何IP,则负载均衡监听会转发全部请求。

  • black:来自所选访问控制策略组中设置的IP地址或地址段的所有请求都不会转发,黑名单适用于应用只限制某些特定IP访问的场景。

    如果开启了黑名单访问,但访问策略组中没有添加任何IP,则负载均衡监听会转发全部请求。

AclStatus参数的值为on时,该参数有效。

AclStatus String off

是否开启访问控制功能。取值:

  • on:开启。
  • off(默认值):关闭。
Description String udp_80

自定义监听名称。

长度限制为1~256个字符,支持中文、字母、数字、短划线(-)、正斜线(/)、半角句号(.)和下划线(_)。

ProxyProtocolV2Enabled Boolean false

是否支持通过Proxy Protocol协议携带客户端源地址到后端服务器。取值:

  • true:是。
  • false(默认值):否。
HealthCheckSwitch String on

是否开启健康检查。取值:

  • on(默认值):开启。
  • off:关闭。

返回数据

名称 类型 示例值 描述
RequestId String 06F00FBB-3D9E-4CCE-9D43-1A6946A75556

请求ID。

示例

请求示例

http(s)://[Endpoint]/?RegionId=cn-hangzhou
&Action=CreateLoadBalancerUDPListener
&LoadBalancerId=lb-bp1ygod3yctvg1y7****
&ListenerPort=80
&BackendServerPort=80
&Bandwidth=-1
&Scheduler=wrr
&HealthyThreshold=4
&UnhealthyThreshold=4
&HealthCheckConnectTimeout=100
&HealthCheckConnectPort=80
&healthCheckInterval=3
&healthCheckReq=hello
&healthCheckExp=ok
&VServerGroupId=rsp-cige6j8****
&MasterSlaveServerGroupId=rsp-0bfucwu****
&AclId=123
&AclType=white
&AclStatus=off
&Description=udp_80
&ProxyProtocolV2Enabled=false
&HealthCheckSwitch=on
&公共请求参数

正常返回示例

XML格式

HTTP/1.1 200 OK
Content-Type:application/xml

<CreateLoadBalancerUDPListenerResponse>
    <RequestId>06F00FBB-3D9E-4CCE-9D43-1A6946A75556</RequestId>
</CreateLoadBalancerUDPListenerResponse>

JSON格式

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "06F00FBB-3D9E-4CCE-9D43-1A6946A75556"
}

错误码

HttpCode 错误码 错误信息 描述
400 InvalidParameterValue.SpecNotSupport The loadBalancer of shared spec does not support the parameter value, %s. 共享型负载均衡实例不支持指定的参数取值。
400 OperationNotSupport.Acl The cloud box instance does not support acl. 云盒实例不支持配置访问控制。
400 InvalidParameterValue.RegionNotSupport The region does not support the parameter value, %s. 当前地域不支持指定的参数取值。
400 Abs.VServerGroupIdAndMasterSlaveServerGroupId.MissMatch The parameters VServerGroupId or MasterSlaveServerGroupId miss match. 参数VServerGroupId或MasterSlaveServerGroupId不匹配。
400 IpVersionConflict The ip version of this LoadBalancer and the Acl is conflict. 指定负载均衡的IP版本与ACL支持的IP类型冲突。
400 InvalidParameterValue.ZoneNotSupport The zone does not support the parameter value, %s. 当前可用区不支持指定参数取值。
400 ListenerProcessing A previous configuration of the listener is pending,please try again later. 当前监听正在配置中,请稍后重试。
400 AclNotExist Acl does not exist. 指定的Acl不存在。
400 InvalidParameter.ListenerPortConflict There is conflict listener port exists. 指定的监听端口已存在。
400 InvalidParam.VServerGroupId The specified VServerGroupId is invalid. 指定的VServerGroupId无效。请检查参数约束,并在修改后重试。
400 MissingParam.HealthCheckConnectPort The parameter HealthCheckConnectPort is required. 参数HealthCheckConnectPort缺失。
400 InvalidParam.ListenerPort The specified ListenerPort is invalid. 指定的ListenerPort无效。请检查参数约束,并在修改后重试。
400 InvalidParam.StartPort The specified StartPort is invalid. 指定的StartPort无效。请检查参数约束,并在修改后重试。
400 InvalidParamSize.PortRange The size of param PortRange is invalid. 指定的PortRange无效。请检查参数约束,并在修改后重试。
400 InvalidParam.EndPort The specified EndPort is invalid. 指定的EndPort无效。请检查参数约束,并在修改后重试。
400 QuotaLimitExceeds.AclAttachedToListener %s. Acl绑定监听数已达到配额上限。
400 QuotaLimitExceeds.TotalAclEntry %s. Acl条目数已达到配额上限。
400 Duplicated.AclEntry %s. Acl条目重复。
400 InvalidParameter.RegionNotSupport The region does not support the parameter: %s. 当前区域不支持指定参数。
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 InvalidParamLength.HealthCheckExp The length of the parameter HealthCheckReq is invalid. 指定的HealthCheckExp无效。请检查参数约束,并在修改后重试。
400 InvalidParamLength.HealthCheckReq The length of the parameter HealthCheckReq is invalid. 指定的HealthCheckReq无效。请检查参数约束,并在修改后重试。
400 InvalidParam.HealthCheckReq The param HealthCheckReq is invalid. 指定的HealthCheckReq无效。请检查参数约束,并在修改后重试。
400 InvalidParam.HealthCheckExp The param HealthCheckExp is invalid. 指定的HealthCheckExp无效。请检查参数约束,并在修改后重试。
400 ResourceNotFound.VServerGroup %s. 指定的服务器组不存在。
400 IllegalParam.FailoverThreshold The parameter FailoverThreshold is illegal. 指定的FailoverThreshold无效。请检查参数约束,并在修改后重试。
400 IllegalParam.FailoverStrategy The parameter FailoverStrategy is illegal. 指定的FailoverStrategy无效。请检查参数约束,并在修改后重试。
400 InvalidParameter.ZoneNotSupport The zone does not support the parameter %s. 当前可用区不支持指定参数。
400 MasterSlaveServerConflict The servers are conflict for MasterSlaveGroup. 主备服务器组的后端服务器冲突。
400 VipNotSupportQuicVersion The listener does not support the parameter of QuicVersion. 当前监听不支持QuicVersion参数。
400 IllegalParam.HealthCheckType The param of HealthCheckType is illegal. 指定的HealthCheckType无效。请检查参数约束,并在修改后重试。
400 MissingParam.HealthCheckMethod The param of HealthCheckMethod is missing. 参数HealthCheckMethod缺失。
400 IllegalParam.HealthCheckMethod The param of HealthCheckMethod is illegal. 指定的HealthCheckMethod无效。请检查参数约束,并在修改后重试。
400 IllegalParam.HealthCheck The param of HealthCheck is illegal. 指定的HealthCheck无效。请检查参数约束,并在修改后重试。
400 OperationDenied.SpecialListenerPortNotAllowed The operation is not allowed because port 4789 is reserved by the system. 操作被拒绝,原因是4789是系统保留端口。
400 Mismatch.SlbSpecTypeAndListenerProtocol The SlbSpecType and ListenerProtocol are mismatched. 实例规格类型和监听类型不匹配。
400 OperationDenied.OnlyIpv4SlbSupport The operation is not allowed because of OnlyIpv4SlbSupport. 操作被拒绝,原因是只有IPV4实例支持开启FULL NAT模式。
400 OperationDenied.FullNatModeNotAllowed The operation is not allowed because of FullNatModeNotAllowed. 操作被拒绝,原因是不支持FullNat模式。
400 SpecNotSupportParameter The instance with share spec does not support FullNatEnabled parameter. 共享型实例不支持FullNatEnabled参数。

访问错误中心查看更多错误码。