After creating a Classic CLB instance, you need to configure a listener for it. The listener listens to requests on the instance and forwards traffic to real servers based on the load balancing policy.
You need to create a CLB instance first and select "Classic CLB" as the instance type.
Configuring the listener
Step 1. Open the "Listener Management" page
- Log into the CLB Console.
- Select Instance Management on the left sidebar.
- In the instance list, click the ID of the instance to be configured to enter the instance details page.
- Click the Listener Management tab or click Configure listener in the "Operation" column.
- The "Listener Management" page is as shown below.
Step 2. Configure a listener
Click Create in Listener and configure a TCP listener in the pop-up window.
1. Basic configuration
|Listener protocol and port
||Listener protocol and listener port
Listener protocol: CLB supports various protocols, including TCP, TCP, HTTP, and HTTPS. UDP is used in this example.Listener port: used to receive and forward requests to real servers, the port value range: 1–65535.The listener port must be unique in the same CLB instance.
||The port through which the CVM provides services, receives and processes the traffic from CLB
The specific configuration for creating a TCP listener is as shown below:
2. Advanced Configuration
||For TCP listeners, CLB supports two scheduling algorithms: weighted round-robin (WRR) and weighted least-connection (WLC)
WRR: requests are sequentially forwarded to different real servers according to their weights. Scheduling is based on the number of new connections, where servers with higher weights have more polls (i.e., a higher probability), while servers with the same weight process the same number of connections.WLC: loads on servers are estimated according to their number of active connections. Scheduling is based on server loads and weights. If their weights are the same, servers with fewer active connections will have more polls (i.e., a higher probability).
|Session persistence status
||Whether to enable or disable session persistence
If session persistence is enabled, the CLB listener will distribute access requests from the same client to the same real server.TCP session persistence is implemented based on client IP address, i.e., access requests from the same IP address are forwarded to the same real server.Session persistence can be enabled for WRR scheduling but not WLC scheduling.
|Session persistence time
||Session persistence time
If there is no new request in the connection within the session persistence time, session persistence will be automatically disconnected.Value range: 30–3,600s.
The specific configuration is as shown below:
3. Health check
|Health Check Configuration Item
|Health check status
||Whether to enable or disable health check. In TCP listeners, CLB instances send SYN packets to specified server ports to perform health checks.
|Response timeout period
|| Maximum response timeout period for health checks.If a real server fails to respond within the timeout period, it is considered abnormal.Value range: 2–60s. Default value: 2s.
||Interval between two health checks.Value range: 5–300s. Default value: 5s.
||If the health check results received are failures for n times (n is the entered number) in a row, the instance will be considered unhealthy, and the status displayed in the console will be abnormal.Value range: 2–10 times. Default value: 3 times
||If the health check results received are successes for n times (n is the entered number) in a row, the instance will be considered healthy, and the status displayed in the console will be healthy.Value range: 2–10 times. Default value: 3 times.
The specific configuration of health check is as shown below:
Step 3. Bind a CVM instance
Click Bind on the "Listener Management" page and select the CVM instance to be bound in the pop-up window, as shown below:
Below is a screenshot after configuration:
If you configure multiple listeners to a Classic CLB instance and bind multiple real servers, each listener will forward requests to all real servers according to its configuration.
Step 4. Configure the security group (optional)
You can configure a CLB security group to isolate public network traffic. For more information, please see Configuring a CLB Security Group.
Step 5. Modify or delete a listener (optional)
If you need to modify or delete a created listener, select the listener on the "Listener Management" page and select Modify or Delete.