TCP Listener Introduction
You can add a TCP listener on the CLB instance to forward TCP protocol requests from the client's end. The TCP protocol is suitable for scenes that have high requirements for reliability and data accuracy but low requirements for transmission speed, such as file transfer, email sending and receiving, remote login, etc. For the listener of TCP protocol, its backend server can directly obtain the real IP of the client.
Configuring TCP Listener
Step 1: Open the Listener Management page
- Log in to the CLB console.
- In the left sidebar, select LB Instance List.
- On the CLB Instance List page, click the instance ID that needs to be configured to enter the Instance Details page.
- Click the Listener Management tab.
Step 2: Configure the listener
Under the TCP/UDP Listener, click Create and configure TCP Listener in the pop-up box.
1. Basic Configuration
| Basic Configuration of Listener | Description | Example |
|---|---|---|
| Name | The Name of the Listener | test-tcp-80 |
| Listening Protocol Port | The Listener's Protocol and Listening Port - Listening protocol: The protocols supported by CLB under this listener include TCP and UDP. In this example, TCP is selected. - Listening port: The port is used to receive requests and forward them to the backend server. The port range is 1-65535. - The listening ports in the same CLB instance cannot be repeated. |
TCP:80 |
| Balance Mode | In the TCP listener, the CLB supports two scheduling algorithms: Weighted Round-Robin (WRR) and Weighted Least Connections (WLC). - Polling by Weight: Distribute requests to different servers in turn according to the weight of the backend servers. The weighted round-robin algorithm is based on the number of newly created connections to schedule. The servers with a higher weight are more often (probably) to be polled, and servers with the same weight handle the same number of connections. - Min.Weighted Connections: Estimate the server's load based on the currently active number of connections. The weighted least connections scheduling algorithm takes into account both the server's load and its weight for comprehensive dispatching. When the weight values are the same, the backend server with a smaller current number of connections is polled more frequently (probability). |
Poll by weight. |
The basic configuration of creating a TCP listener is shown in the figure below.

2. Health Check
| Health Check Configuration | Description | Example |
|---|---|---|
| Health Check Status | Enable or disable health check. In the TCP listener, the CLB instance sends a SYN packet to the specified server port for a health check. | Enable |
| Response Timeout. | - The maximum timeout for health check responses. - If the backend CVM does not respond correctly within the timeout period, it is considered a health check exception. - Configurable range: 2 - 60 seconds. The default value is 2 seconds. |
2s |
| Detection Interval | - The interval for the CLB health check. - Configurable range: 5-300 seconds, default value is 5 seconds. |
5s |
| Unhealthy Threshold | - If the health check results received for n consecutive times (n is the filled value) are failed, it is identified as unhealthy, and the console displays as Abnormal. - Configurable range: 2-10 times, default value is 3 times. |
3 times |
| Health Threshold | - If the health check results received for n consecutive times (n is the filled value) are successful, it is identified as healthy, and the console displays as Healthy. - Configurable range: 2-10 times, default value is 3 times. |
3 times |
The specific configuration of the health check is shown in the following figure:

3. Session Persistence
| Session Persistence Configuration | Description | Example |
|---|---|---|
| Session Affinity Status | Enable or disable session persistence. - After session persistence is enabled, the CLB listener will distribute access requests from the same client to the same backend server. - The TCP protocol is session persistence based on the client IP address, that is, access requests from the same IP address are forwarded to the same backend server. - WRR scheduling supports session persistence, but WLC scheduling does not support enabling the session persistence feature. |
Enable |
| Session Hold Time | Session Hold Time - When the hold time is exceeded and there is no new request in the connection, the session will be automatically disconnected. - Configurable range 30-3,600 seconds. |
30s |
The specific configuration of session persistence is shown in the following figure.

Step 3: Bind the backend CVM
- On the "Listener Management" page, click the created listener, such as
TCP:80Listener above, and you can view the bound backend services on the right side of the listener.

2. Click Bind, select the backend server to be bound in the pop-up, and configure the service port and weight.
- Add Port Features: In the "Selected" Cloud Virtual Machine box on the right, click Add Port to add multiple ports of the same Cloud Virtual Machine, such as adding ports 80, 81, and 82 of CVM at the same time.
- Default port feature: Fill in Default Port first, then select the CVM. The port of each CVM is the default port.

After completing Step 1 to Step 3, the TCP listener rules are configured.
Step 4: Modify/delete listeners (optional)
If you need to modify or delete a created listener, on the "Listener Management" page, click the created listener and select Modify or Delete to complete the operation.
