All Products
Search
Document Center

Server Load Balancer:SetLoadBalancerTCPListenerAttribute

Last Updated:Sep 20, 2024

Modifies the configurations of a TCP listener of Classic Load Balancer (CLB).

Operation description

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
slb:SetLoadBalancerTCPListenerAttributeupdate
  • acl
    acs:slb:{#regionId}:{#accountId}:acl/{#aclId}
  • loadbalancer
    acs:slb:{#regionId}:{#accountId}:loadbalancer/{#loadbalancerId}
  • slb:tag
none

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringNo

The region ID of the CLB instance.

You can query the region ID from the Regions and zones list or by calling the DescribeRegions operation.

cn-hangzhou
LoadBalancerIdstringYes

The ID of the CLB instance.

lb-bp1ygod3yctvg1y****
ListenerPortintegerYes

The frontend port used by the CLB instance.

Valid values: 1 to 65535.

80
BandwidthintegerNo

The maximum bandwidth of the listener. Unit: Mbit/s. Valid values: -1 and 1 to 5120.

  • -1: For a pay-by-data-transfer Internet-facing CLB instance, you can set this parameter to -1, which specifies unlimited bandwidth.
  • 1 to 5120: For a pay-by-bandwidth Internet-facing CLB instance, you can specify the maximum bandwidth of each listener. The sum of the maximum bandwidth values of all listeners cannot exceed the maximum bandwidth of the CLB instance.
43
SchedulerstringNo

The scheduling algorithm. Valid values:

  • wrr: Backend servers that have higher weights receive more requests than backend servers that have lower weights.
  • rr: Requests are distributed to backend servers in sequence.
  • sch: specifies consistent hashing that is based on source IP addresses. Requests from the same source IP address are distributed to the same backend server.
  • tch: specifies consistent hashing that is based on four factors: source IP address, destination IP address, source port, and destination port. Requests that contain the same information based on the four factors are distributed to the same backend server.
Note
  • Only high-performance CLB instances support the sch and tch algorithms.
  • CLB does not support converting the wrr and rr algorithms to sch or tch. You cannot switch the hash algorithm from one to another.
wrr
PersistenceTimeoutintegerNo

The timeout period of session persistence. Valid values: 0 to 3600. Unit: seconds.

Default value: 0. If the default value is used, the system disables session persistence.

0
EstablishedTimeoutintegerNo

The timeout period of a connection. Unit: seconds. Valid values: 10 to 900.

500
HealthyThresholdintegerNo

The number of times that an unhealthy backend server must consecutively pass health checks before it is declared healthy. In this case, the health status is changed from fail to success.

Valid values: 2 to 10.

4
UnhealthyThresholdintegerNo

The number of times that a healthy backend server must consecutively fail health checks before it is declared unhealthy. In this case, the health status is changed from success to fail.

Valid values: 2 to 10.

4
HealthCheckConnectTimeoutintegerNo

The timeout period of a health check.

If a backend ECS instance does not return a health check response within the specified timeout period, the server fails the health check.

Valid values: 1 to 300. Unit: seconds.

Note If the value of the HealthCheckConnectTimeout parameter is smaller than that of the HealthCheckInterval parameter, the timeout period specified by the HCTimeout parameter is ignored and the period of time specified by the HealthCheckInterval parameter is used as the timeout period.
100
HealthCheckConnectPortintegerNo

The port that is used for health checks. Valid values: 1 to 65535.

If you do not set this parameter, the port specified by the BackendServerPort parameter is used.

8080
HealthCheckIntervalintegerNo

The interval between two consecutive health checks. Unit: seconds.

Valid values: 1 to 50.

5
HealthCheckDomainstringNo

The domain name that is used for health checks. You can set this parameter when the TCP listener requires HTTP health checks. If you do not set this parameter, TCP health checks are performed.

  • $_ip: the private IP addresses of the backend servers.

    If you do not set the HealthCheckHost parameter or set the parameter to $SERVER_IP, the CLB instance uses the private IP addresses of backend servers for health checks.

  • domain: The domain name is 1 to 80 characters in length, and can contain letters, digits, periods (.), and hyphens (-).

192.168.XX.XX
HealthCheckURIstringNo

The URI that is used for health checks. The URI must be 1 to 80 characters in length, and can contain letters, digits, hyphens (-), forward slashes (/), periods (.), percent signs (%), question marks (?), number signs (#), and ampersands (&). The URI must start with a forward slash (/) but cannot be a single forward slash (/).

You can set this parameter when the TCP listener requires HTTP health checks.

If you do not set this parameter, TCP health checks are performed.

/test/index.html
HealthCheckHttpCodestringNo

The HTTP status code for a successful health check. Separate multiple HTTP status codes with commas (,).

Valid values: http_2xx, http_3xx, http_4xx, and http_5xx.

http_2xx
HealthCheckTypestringNo

The type of the health check. Valid values: tcp and http.

tcp
SynProxystringNo

Specifies whether to enable the SynProxy feature of CLB for protection. Valid values:

  • enable: yes
  • disable: no

We recommend that you use the default value of this parameter.

enable
VServerGroupstringNo

Specifies whether to use a vServer group. Valid values:

  • on: yes
  • off: no
Note You cannot set both VserverGroup and MasterSlaveServerGroup to on.
on
VServerGroupIdstringNo

The ID of the vServer group.

rsp-cige6j5****
MasterSlaveServerGroupIdstringNo

The ID of the primary/secondary server group.

Note You can set only one of the VServerGroupId and MasterSlaveServerGroupId parameters.
rsp-cige****
MasterSlaveServerGroupstringNo

Specifies whether to use a primary/secondary server group. Valid values:

  • on: yes
  • off: no

You cannot set both VserverGroup and MasterSlaveServerGroup to on.

on
AclIdstringNo

The ID of the network access control list (ACL) that is associated with the listener.

If AclStatus is set to on, this parameter is required.

12333
AclTypestringNo

The type of the network ACL. Valid values:

  • white: a whitelist. Only requests from the IP addresses or CIDR blocks in the network ACL are forwarded. Whitelists apply to scenarios where you want to allow only specific IP addresses to access an application. Your service may be adversely affected if the allowlist is not properly configured. After a whitelist is configured, only requests from IP addresses that are added to the whitelist are forwarded by the listener.

    If you enable a whitelist but do not add an IP address to the ACL, the listener forwards all requests.

  • black: a blacklist. All requests from the IP addresses or CIDR blocks in the ACL are rejected. Blacklists apply to scenarios where you want to block access from specified IP addresses to an application.

    If a blacklist is configured for a listener but no IP address is added to the blacklist, the listener forwards all requests.

Note If AclStatus is set to on, this parameter is required.
white
AclStatusstringNo

Specifies whether to enable access control. Valid values:

  • on: yes
  • off: no
off
DescriptionstringNo

The name of the listener.

The name must be 1 to 256 characters in length and can contain letters, digits, hyphens (-), forward slashes (/), periods (.), and underscores (_).

tcp_80
ConnectionDrainstringNo

Specifies whether to enable connection draining. Valid values:

  • on: yes
  • off: no
off
ConnectionDrainTimeoutintegerNo

The timeout period of connection draining. This parameter is required if ConnectionDrain is set to on. Unit: seconds.

Valid values: 10 to 900.

300
ProxyProtocolV2EnabledbooleanNo

Specifies whether to use the Proxy protocol to pass client IP addresses to backend servers. Valid values:

  • true: yes
  • false: no
false
HealthCheckSwitchstringNo

Specifies whether to enable the health check feature. Valid values:

  • on: yes
  • off: no
on

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The ID of the request.

CEF72CEB-54B6-4AE8-B225-F876FF7BA984

Examples

Sample success responses

JSONformat

{
  "RequestId": "CEF72CEB-54B6-4AE8-B225-F876FF7BA984"
}

Error codes

HTTP status codeError codeError message
400InvalidParameterValue.SpecNotSupportThe loadBalancer of shared spec does not support the parameter value, %s.
400OperationNotSupport.AclThe cloud box instance does not support acl.
400InvalidParameterValue.RegionNotSupportThe region does not support the parameter value, %s.
400IpVersionConflictThe ip version of this LoadBalancer and the Acl is conflict.
400InvalidParameterValue.ZoneNotSupportThe zone does not support the parameter value, %s.
400InvalidParameter.ZoneNotSupportThe zone does not support the parameter %s.
400OperationFailed.ServerGroupInUseThe VServerGroup or MasterSlaveServerGroup can not be close for this listener.
400InvalidParam.VServerGroupIdThe specified VServerGroupId is invalid.
400MissingParam.HealthCheckConnectPortThe parameter HealthCheckConnectPort is required.
400InvalidParam.ListenerPortThe specified ListenerPort is invalid.
400InvalidParam.StartPortThe specified StartPort is invalid.
400InvalidParamSize.PortRangeThe size of param PortRange is invalid.
400InvalidParam.EndPortThe specified EndPort is invalid.
400InvalidParam.PortRangeThe specified PortRange is invalid.
400QuotaLimitExceeds.AclAttachedToListener%s.
400QuotaLimitExceeds.TotalAclEntry%s.
400AclListenerOverLimit%s.
400Duplicated.AclEntry%s.
400ResourceNotFound.VServerGroup%s.
400IllegalParam.FailoverStrategyThe parameter FailoverStrategy is illegal.
400IllegalParam.FailoverThresholdThe parameter FailoverThreshold is illegal.
400MasterSlaveServerConflictThe servers are conflict for MasterSlaveGroup.
400MissingParam.VServerGroupIdThe parameter VServerGroupId is missing.
400OperationDenied.HealthCheckClosedForMasterSlaveModeThe operation is denied because of HealthCheckClosedForMasterSlaveMode.
400InvalidParam.HealthCheckThe param of HealthCheck is illegal.
400OperationDenied.MasterSlaveGroupLogEnabledThe operation is denied because of MasterSlaveGroupLogEnabled.
400OperationDenied.NotSupportAclThe operation is denied because The single Tunnel or any Tunnel loadbalancer does not support config AccessControlList.
400OperationDenied.FullNatModeNotAllowedThe operation is not allowed because of FullNatModeNotAllowed.
400OperationDenied.OnlyIpv4SlbSupportThe operation is not allowed because of OnlyIpv4SlbSupport.
400SpecNotSupportParameterThe instance with share spec does not support FullNatEnabled parameter.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2023-09-08The Error code has changedView Change Details