You need to enable JavaScript to run this app.
文档中心
负载均衡

负载均衡

复制全文
下载 pdf
监听器
CreateNLBListener - 添加监听器
复制全文
下载 pdf
CreateNLBListener - 添加监听器
调用 CreateNLBListener 接口,为NLB实例添加一个监听器。​
调试​
API Explorer
您可以通过 API Explorer 在线发起调用,无需关注签名生成过程,快速获取调用结果。
​
请求参数​
Action String 必选 示例值:CreateNLBListener​
要执行的操作,取值为 CreateNLBListener。​
​
Version String 必选 示例值:2020-04-01​
API版本信息,当前版本为 2020-04-01。​
​
LoadBalancerId String 必选 示例值:nlb-bp1o94dp5i6ea****​
NLB实例的ID。​
您可以调用DescribeNetworkLoadBalancers接口,获取NLB实例ID。​
​
ListenerName String 可选 示例值:test​
监听器的名称。​
  • 必须以字母或中文开头,可包含数字、点号(.)、下划线(_)和中划线(-)。​
  • 长度限制在1~128字符之间。​
  • 该参数不传入,则默认为“协议-端口”,例如TCP-80。​
​
Protocol String 必选 示例值:TCP​
监听器的协议。取值如下:​
  • TCP​
  • UDP​
  • TLS​
说明​
  • 双栈NLB实例暂不支持TLS。​
  • TLS协议监听器正在邀测中,如需试用,请联系客户经理。​
​
Port Integer 必选 示例值:80​
监听器接收请求使用的端口。​
  • 单端口的取值范围1~65535。​
  • 0表示启用全端口监听,监听端口段。​
说明​
  • TLS协议监听器不支持启用全端口监听。​
  • 同一NLB实例中,TLS和TCP监听器不可监听同一端口,二者可以与UDP监听器监听同一端口。​
​
StartPort Integer 可选 示例值:1​
全端口监听起始端口。取值范围为1 ~ 65535。​
说明​
参数Port为“0”时,该参数为必填。​
​
EndPort Integer 可选 示例值:65535​
全端口监听结束端口。取值范围为1 ~ 65535。​
说明​
参数Port为“0”时,该参数为必填,且取值必须大于StartPort。​
​
Enabled Boolean 可选 示例值:true​
是否启用监听器。取值如下:​
  • true(默认值):开启。​
  • false:关闭。​
​
CertificateSource String 可选 示例值:SSL​
TLS监听器的服务器证书来源。取值如下:​
  • SSL(默认值):证书中心-SSL 证书。​
  • PCALeaf:证书中心-私有CA 的私有证书。​
​
CertificateId String 可选 示例值:cert-3tjuxoukkq3vj0ww****​
TLS监听器服务器证书的ID,仅支持传入火山引擎证书中心 SSL 证书。​
国密证书证书正在邀测中,如需试用。请联系客户经理。​
​
PCACertificateId String 可选 示例值:cert-3tjuxoukkq3vj0ww****​
TLS监听器服务器证书ID,仅支持传入火山引擎证书中心私有CA 的私有证书。​
说明:​
国密证书证书、证书中心的私有CA正在邀测中,如需试用。请联系客户经理。​
​
CAEnabled Boolean 可选 示例值:true​
是否为TLS监听器开启双向认证。取值如下:​
  • true:开启双向认证。​
  • false(默认值):关闭双向认证。​
此功能正在邀测中,如需试用,请联系客户经理。​
​
CACertificateSource String 可选 示例值:PCARoot​
TLS监听器CA证书的来源。取值如下:​
  • PCARoot:私有CA 的私有根CA 证书。​
  • PCASub:私有CA 的私有子CA 证书。​
说明:​
  • 当CAEnabled为true时,该参数为必填。​
​
CACertificateId String 可选 示例值:pca-********​
TLS监听器关联的 CA 证书,支持传入火山引擎证书中心私有根CA 和私有子CA 证书模块的证书。​
当CAEnabled为true时,该参数为必填。​
  • 证书合法状态:已启用&未过期&未吊销。​
  • 国密证书正在邀测中,如需试用,请联系客户经理。​
​
SecurityPolicyType String 可选 示例值:system​
TLS 监听器的安全策略类型。取值如下:​
  • custom:自定义策略。​
  • system(默认值):系统策略。​
​
SecurityPolicyId String 可选 示例值:tls_cipher_policy_1_0​
TLS 安全策略ID,支持系统安全策略和自定义安全策略。​
  • 系统安全策略取值:​
  • tls_cipher_policy_1_0​
  • tls_cipher_policy_1_1​
  • tls_cipher_policy_1_2​
  • tls_cipher_policy_1_2_strict​
  • tls_cipher_policy_1_2_strict_with_1_3​
  • 自定义安全策略:输入自定义安全策略 ID。​
当Protocol为TLS 时,该参数为必填。​
​
ConnectionTimeout Integer 可选 示例值:800​
监听器的连接超时时间。​
  • 参数Protocol为“TCP” 或“ TLS”时,取值范围为10~900秒,默认为900秒。​
  • 参数Protocol为“UDP”时,取值范围为10~120秒,默认为20秒。​
​
ServerGroupId String 必选 示例值:rsp-bp1o94dp5i6ea****​
监听器关联的服务器组 ID。​
您可以调用DescribeNLBServerGroups接口获取服务器组ID。​
  • 当参数Protocol为TCP时,后端服务器的协议必须为TCP。​
  • 当参数Protocol为UDP时,后端服务器的协议必须为UDP。​
  • 当参数Protocol为TLS时,后端服务器的协议必须为TCP。且不支持选择如下服务器组:​
  • 不支持关联IP 地址类型的服务器组。​
  • 不支持开启Proxy-Protocol 协议的服务器组。​
​
Description String 可选 示例值:This is a listener.​
监听器的描述。​
  • 必须以字母或中文开头,可包含数字、英文逗号(,)、点号(.)、下划线(_)、空格( )、等号(=)、中划线(-)、中文逗号(,)、中文句号(。)​
  • 长度限制为1 ~ 255个字符。​
  • 该参数不传入,则默认为空字符串。​
​
Tags.N.Key String 可选 示例值:key1​
用户标签的标签键。​
  • 参数 - N:表示标签键的序号,取值范围:1~20。​
  • 多个标签键之间用&分隔。​
  • 不能以 volc:或sys:开头,包括任意大小写形式。​
  • 长度取值范围为1~128字符,允许输入各国语言文字、数字、空格( )、下划线(_)、点号(.)、半角冒号(:)、斜杠(/)、等号(=)、加号(+)、中划线(-)和@(@)。​
  • 若标签键开头或结尾存在空格,系统会自动为其去除。​
说明​
同一资源的标签键不允许重复。​
​
Tags.N.Value String 可选 示例值:value1​
用户标签的标签值。​
  • 参数 - N:表示标签值的序号,取值范围:1~20。​
  • 多个标签值之间用&分隔。​
  • 长度取值范围为0~256字符,不填默认为空。​
  • 允许输入各国语言文字、数字、空格( )、下划线(_)、点号(.)、半角冒号(:)、斜杠(/)、等号(=)、加号(+)、中划线(-)和@(@)。​
  • 大小写敏感。​
  • 若标签值开头或结尾存在空格,系统会自动为其去除。​
说明​
若传入该参数,则必须先传入Tags.N.Key。​
​
Cps Integer 可选 示例值:0​
新建连接数限速。​
  • 取值范围:0~1000000。​
  • 默认为0,0表示不限速。​
  • 该监听器捕获的新建连接数超过设置的上限时,超过的部分会被丢弃,不会转发到后端服务器。​
说明​
新建连接数限速功能正在邀测中,如需试用,请联系客户经理。​
​
MaxConnections Integer 可选 示例值:0​
并发连接数限速。​
  • 取值范围:0~10000000。​
  • 默认为0,0表示不限速。​
  • 该监听器捕获的并发连接数超过设置的上限时,超过的部分会被丢弃,不会转发到后端服务器。​
说明​
并发连接数限速功能正在邀测中,如需试用,请联系客户经理。​
​
​
​
返回参数​
RequestId String 示例值:2024092952539010225146063030****​
请求ID。​
​
ListenerId String 示例值:lsn-2fek3rgsxhrsw5oxruwec****​
监听器ID。​
​
​
​
请求示例​
​
GET /?Action=CreateNLBListener&Version=2020-04-01&LoadBalancerId=nlb-bp1o94dp5i6ea****&ListenerName=test&Protocol=TCP&Port=80&StartPort=1&EndPort=65535&Enabled=true&CertificateSource=SSL&CertificateId=cert-3tjuxoukkq3vj0ww****&PCACertificateId=cert-3tjuxoukkq3vj0ww****&CAEnabled=true&CACertificateSource=PCARoot&CACertificateId=pca-********&SecurityPolicyType=system&SecurityPolicyId=tls_cipher_policy_1_0&ConnectionTimeout=800&ServerGroupId=rsp-bp1o94dp5i6ea****&Description=This is a listener.&Tags.1.Key=key1&Tags.1.Value=value1 HTTP/1.1​
Host: clb.cn-beijing.volcengineapi.com​
Date: 20260310T094038Z​
Authorization: HMAC-SHA256 Credential=Adfks******wekfwe/20251121/cn-beijing/clb/request, SignedHeaders=host;x-date, Signature=47a7d934ff7b37c03938******cd7b8278a40a1057690c401e92246a0e41085f​
​
返回示例​
​
{​
"ResponseMetadata": {​
"RequestId": "20230604110420****100232280022D31",​
"Action": "CreateNLBListener",​
"Version": "2020-04-01",​
"Service": "clb",​
"Region": "cn-beijing"​
},​
"Result": {​
"ListenerId": "lsn-2fek3rgsxhrsw5oxruwec****",​
"RequestId": "2024092952539010225146063030****"​
}​
}​
​
错误码​
此处仅展示当前API的错误码,更多错误码请参见公共错误码。​
​
状态码​
错误码​
错误信息​
说明​
400​
DryRunOperation​
Exception raised to indicate a successfully authorized action when the DryRun flag is set to true.​
该请求设置为DryRun操作,操作授权已获得许可,但未被实际执行。​
400​
IdempotentParameterMismatch​
Arguments on this idempotent request are inconsistent with arguments used in previous request(s).​
此幂等请求的参数与前一个请求中使用的参数不一致。​
400​
InvalidCACertificate.UnSupportAction​
The specified CACertificate does not support this action, due to the content of the ca certificate is illegal.​
指定的 CA 证书由于内容不合法,不支持当前操作。​
400​
InvalidCACertificateId.CAEnabledMismatch​
The specified CACertificateId not match with CAEnabled.​
指定的 CACertificateId 与监听器 CAEnabled 不一致。​
400​
InvalidCACertificateSource.CAEnabledMismatch​
The specified CACertificateSource not match with CAEnabled.​
指定的 CACertificateSource 与监听器 CAEnabled 不一致。​
400​
InvalidCACertificateSource.Malformed​
The specified CACertificateSource is malformed.​
指定的 CACertificateSource 参数格式不合法。​
400​
InvalidCAEnabled.Malformed​
The specified CAEnabled is malformed.​
指定的 CAEnabled 参数格式不合法。​
400​
InvalidCAEnabled.ProtocolMismatch​
The specified CAEnabled not match with Protocol.​
指定的 CAEnabled 与监听器协议类型不一致。​
400​
InvalidCertificate.DomainTotalCount​
The specified Certificate does not support this action, due to the total number of the certificate domain is illegal.​
指定的证书由于域名总数量不合法,不支持当前操作。​
400​
InvalidCertificate.DomainTotalLength​
The specified Certificate does not support this action, due to the total length of the certificate domain is illegal.​
指定的证书由于域名总长度不合法,不支持当前操作。​
400​
InvalidCertificate.UnSupportAction​
The specified Certificate does not support this action, due to the content of the certificate is illegal.​
指定的证书由于内容不合法,不支持当前操作。​
400​
InvalidCertificateId.ProtocolMismatch​
The specified CertificateId not match with Protocol.​
指定的 CertificateId 与监听器协议类型不一致。​
400​
InvalidCertificateLength.Malformed​
The specified CertificateLength is malformed.​
指定的 CertificateLength 参数格式不合法。​
400​
InvalidCertificateSource.CertificateIdMismatch​
The specified CertificateSource not match with CertificateId.​
指定的 CertificateSource 与指定的 CertificateId 不一致。​
400​
InvalidCertificateSource.Malformed​
The specified CertificateSource is malformed.​
指定的 CertificateSource 参数格式不合法。​
400​
InvalidCertificateSource.PCACertificateIdMismatch​
The specified CertificateSource not match with PCACertificateId.​
指定的 CertificateSource 与指定的 PCACertificateId 不一致。​
400​
InvalidCertificateSource.ProtocolMismatch​
The specified CertificateSource not match with Protocol.​
指定的 CertificateSource 与监听器协议类型不一致。​
400​
InvalidClientToken.Malformed​
The specified ClientToken is malformed.​
指定的 ClientToken 参数格式不合法。​
400​
InvalidConnectionTimeout.Malformed​
The specified ConnectionTimeout is malformed.​
指定的 ConnectionTimeout 参数格式不合法。​
400​
InvalidDescription.Malformed​
The specified Description is malformed.​
指定的 Description 参数格式不合法。​
400​
InvalidEnabled.Malformed​
The specified Enabled is malformed.​
指定的 Enabled 参数格式不合法。​
400​
InvalidEndPort.Malformed​
The specified EndPort is malformed.​
指定的 EndPort 参数格式不合法。​
400​
InvalidIPAddressVersion.TypeMismatch​
The specified IPAddressVersion and Type are not matched.​
指定的 IP 类型与服务器组类型不匹配。​
400​
InvalidIncorrectOrder.Malformed​
The specified index order is malformed.​
指定的索引顺序参数格式不合法。​
400​
InvalidListenerName.Malformed​
The specified ListenerName is malformed.​
指定的 ListenerName 参数格式不合法。​
400​
InvalidListenerPort.ProtocolMismatch​
The specified Listener Port not match with Protocol.​
指定的端口与监听器协议类型不一致。​
400​
InvalidLoadBalancer.InvalidStatus​
The specified LoadBalancer is not in the correct status for the request.​
指定的负载均衡所处状态无法响应该请求。​
400​
InvalidLoadBalancerBillingStatus.InvalidStatus​
The specified LoadBalancer is not in the correct billing status for the request.​
指定的负载均衡计费状态所处状态无法响应该请求。​
400​
InvalidLoadBalancerIPAddressVersion.UnSupportAction​
The specified IPAddressVersion of LoadBalancer does not support this action.​
指定的实例因 IP 地址类型不支持当前操作。​
400​
InvalidPCACertificateId.ProtocolMismatch​
The specified PCACertificateId not match with Protocol.​
指定的 PCACertificateId 与监听器协议类型不一致。​
400​
InvalidPort.Malformed​
The specified Port is malformed.​
指定的 Port 参数格式不合法。​
400​
InvalidPrivateKey.Malformed​
The specified PrivateKey is malformed.​
指定的 PrivateKey 参数格式不合法。​
400​
InvalidProject.Malformed​
The specified Project is malformed.​
指定的 Project 参数格式不合法。​
400​
InvalidProtocol.Malformed​
The specified Protocol is malformed.​
指定的 Protocol 参数格式不合法。​
400​
InvalidPublicKey.Malformed​
The specified PublicKey is malformed.​
指定的 PublicKey 参数格式不合法。​
400​
InvalidPublicKey.PrivateKeyMisMatch​
The PublicKey and PrivateKey are not matched.​
指定的公钥与私钥不匹配。​
400​
InvalidQuotaCode.Malformed​
The specified QuotaCode is malformed.​
指定的 QuotaCode 参数格式不合法。​
400​
InvalidSecurityPolicy.InvalidStatus​
The specified SecurityPolicy is not in the correct status for the request.​
指定的安全策略所处状态无法响应该请求。​
400​
InvalidSecurityPolicyId.ProtocolMismatch​
The specified SecurityPolicyId not match with Protocol.​
指定的 SecurityPolicyId 与监听器协议类型不一致。​
400​
InvalidSecurityPolicyType.Malformed​
The specified SecurityPolicyType is malformed.​
指定的 SecurityPolicyType 参数格式不合法。​
400​
InvalidSecurityPolicyType.ProtocolMismatch​
The specified SecurityPolicyType not match with Protocol.​
指定的 SecurityPolicyType 与监听器协议类型不一致。​
400​
InvalidSecurityPolicyType.SecurityPolicyIdMismatch​
The specified SecurityPolicyType not match with SecurityPolicyId.​
指定的 SecurityPolicyType 与指定的 SecurityPolicyId 不一致。​
400​
InvalidServerGroup.InvalidStatus​
The specified ServerGroup is not in the correct status for the request.​
指定的服务器组所处状态无法响应该请求。​
400​
InvalidServerGroup.ListenerPortMismatch​
The specified ServerGroup.AnyPortEnabled and Listener.Port are not matched.​
指定的后端服务器组 AnyPortEnable 类型与监听器 Port 属性不匹配。​
400​
InvalidServerGroup.ListenerProtocolMismatch​
The specified ServerGroup.Protocol and Listener.Protocol are not matched.​
指定的后端服务器组协议与监听器协议不匹配。​
400​
InvalidServerGroup.LoadBalancerMismatch​
The specified ServerGroup and LoadBalancer is mismatched.​
指定的服务器组和实例不匹配。​
400​
InvalidServerGroup.LoadBalancerVpcMismatch​
The specified ServerGroup's Vpc is not matched with LoadBalancer.​
指定的服务器组的 VPC 与负载均衡实例不匹配。​
400​
InvalidServerGroupProxyProtocolType.UnSupportAction​
The specified ProxyProtocolType of ServerGroup does not support this action.​
指定的后端服务器组因 Proxy-Protocol 协议不支持当前操作。​
400​
InvalidServerGroupType.UnSupportAction​
The specified Type of ServerGroup does not support this action.​
指定的后端服务器组类型不支持当前操作。​
400​
InvalidSite.NotSupportBidirectionalAuthentication​
The specified site does not support listener bidirectional authentication.​
指定的账户归属环境未开通监听器双向认证功能。​
400​
InvalidStartOrEndPort.Malformed​
The specified StartOrEndPort is malformed.​
指定的 StartOrEndPort 参数格式不合法。​
400​
InvalidStartPort.Malformed​
The specified StartPort is malformed.​
指定的 StartPort 参数格式不合法。​
400​
InvalidTagKey.Malformed​
The specified TagKey is malformed.​
指定的 TagKey 参数格式不合法。​
400​
InvalidTagValue.Malformed​
The specified TagValue is malformed.​
指定的 TagValue 参数格式不合法。​
400​
LimitExceeded.ServiceManagedTag​
You've reached the limit on the number of service managed tags that you can create.​
已达到单次可创建受管资源标签键值数量的上限。​
400​
LimitExceeded.TagOperation​
You've reached the limit on the number of tags that you can operate at a time.​
已达到单次可操作的标签条目数量上限。​
400​
OperationFailed.QueryPcaService​
The request for the specified resource operation failed due to an abnormal access issue with the pca service.​
由于证书中心 PCA 服务的访问异常,对指定资源的操作请求失败。​
400​
QuotaExceed.ListenerNumberEachInstance​
You've reached the limit on the number of listeners that you can create.​
已达到单实例可创建监听器的数量的配额上限。​
400​
QuotaExceed.ListenerNumberEachServerGroup​
You've reached the limit on the number of listeners that you can associate.​
已达到服务器组可关联的监听器的数量的配额上限。​
400​
QuotaExceed.PortRangeListenerNumberEachInstance​
You've reached the limit on the number of portRange listeners that you can create.​
已达到可创建的全端口监听器的数量的配额上限。​
400​
QuotaExceed.ServerNumberEachInstance​
You've reached the limit on the number of servers that you can mount on instance.​
已达到单实例可挂载后端服务器的数量的配额上限。​
403​
Forbidden​
You are not authorized to perform operations on the specified service.​
无权限对指定服务进行操作。​
403​
Forbidden​
You are not authorized to perform operations on the service managed tag.​
无权限对指定资源打上受管标签。​
403​
Forbidden​
You are not authorized to perform operations on the system tag.​
无权限对指定资源打上系统标签。​
403​
InvalidResourceType.ServiceManaged​
The specified ResourceType is managed by a service.​
指定的资源是服务托管资源。​
404​
InvalidCACertificate.NotFound​
The specified CACertificate does not exist.​
指定的 CA 证书不存在。​
404​
InvalidCertificate.NotFound​
The specified Certificate does not exist.​
指定的证书不存在。​
404​
InvalidLoadBalancer.NotFound​
The specified LoadBalancer does not exist.​
指定的负载均衡不存在。​
404​
InvalidProject.NotFound​
The specified Project does not exist.​
指定的项目不存在。​
404​
InvalidSecurityPolicy.NotFound​
The specified SecurityPolicy does not exist.​
指定的安全策略不存在。​
404​
InvalidServerGroup.NotFound​
The specified ServerGroup does not exist.​
指定的后端服务器组不存在。​
404​
ServiceRoleForLoadBalancer.NotFound​
ServiceRoleForLoadBalancer does not exist.​
负载均衡服务关联角色不存在。​
409​
InvalidOperation.Conflict​
The specified resource operation conflicts.​
指定的资源操作冲突。​
409​
InvalidPort.Conflict​
The specified Port already exists.​
指定的端口已存在。​
412​
IdempotentProcessing​
The request uses the same client token as a previous one that is still in process.​
幂等请求处理中。​
​
​
最近更新时间:2026.09.18 11:20:51
这个页面对您有帮助吗?
有用
有用
无用
无用