This topic describes how to configure a CLB instance. Before you can configure a Classic Load Balancer (CLB) instance to forward traffic, you must add at least one listener and one group of backend servers to the CLB instance. The following example describes how to add a TCP listener and two Elastic Compute Service (ECS) instances to a CLB instance. The ECS instances are named ECS 01 and ECS 02. The ECS instances function as backend servers and host static web pages.
- Log on to the CLB console.
- On the Instances page, find the CLB instance that you want to manage and click Configure Listener in the Actions column.
- On the Protocol and Listener wizard page, set the following parameters to configure the listener. Use the default
settings for other parameters.
Parameter Description Select Listener Protocol Select a protocol for the listener.
In this example, TCP is selected.
Listening Port Specify the port that the CLB instance uses to receive requests and forward the requests to backend servers. In this example, the port number is set to 80.Note The ports on which a CLB instance listens must be unique. Listener Name Enter a name for the listener. By default, the system sets the parameter to protocol_port if you do not specify this parameter. Advanced Scheduling Algorithm Select the scheduling algorithm. In this example, Round-Robin (RR) is selected.
- Weighted Round-Robin (WRR): Requests are distributed to backend servers in sequence. A backend servers that has a higher weight receives more requests.
- Round-Robin (RR): Requests are distributed to backend servers in sequence.
- Consistent Hash (CH): Only high-performance CLB instances support the CH algorithm.
Enable Session Persistence After you enable session persistence, requests from the same IP address are forwarded to the same backend server. Enable Access Control After you enable access control, you can configure a whitelist to allow access from specified IP addresses, or a blacklist to deny access from specified IP addresses. Enable Peak Bandwidth Limit You can select different bandwidth limits to define the service capability of applications on a backend ECS instance.
In this example, the CLB instance has unlimited bandwidth and is billed on a pay-by-data-transfer basis. Therefore, this parameter is not set.
Idle Timeout Specify the timeout period of idle connections. If no response is received through a connection within the specified timeout period, CLB automatically closes the connection. Value values: 10 to 900. Unit: seconds. Proxy Protocol Specify whether to use the proxy protocol to forward client IP addresses or VPC IDs to backend servers. Obtain Client Source IP Address By default, this feature is enabled.
- Click Next to configure backend servers. In this example, the default server group is used.
- On the Backend Servers wizard page, select Default Server Group and click Add More to add backend servers.
- In the My Servers panel, select ECS 01 and ECS 02 that you created, and click Next.
- A backend server that has a higher weight receives more requests. The default value is 100. We recommend that you use the default value.
- Click Add.
- On the Default Server Group tab, specify backend ports that are available to receive requests. The ports are used by backend ECS instances to receive requests. You can specify the same port for multiple backend servers that are added to the same CLB instance. In this example, the port number is set to 80.
- Click Next to configure health checks. In this example, the default health check settings are
After you enable health checks for the CLB instance, the CLB instance periodically checks whether the backend ECS instances are healthy. When the CLB instance detects an unhealthy ECS instance, the CLB instance distributes the requests to other healthy ECS instances. When the unhealthy ECS instance recovers, the CLB instance starts to distribute requests to the ECS instance again.
- Click Next. On the Confirm wizard page, check the configurations and click Submit.
- Click OK to go back to the Instances page. If the health check status of a backend ECS instance is Active, the backend server can process requests as normal.
- Enter the service address of the CLB instance into the address bar of the browser
to check the connectivity. We recommend that you run the test multiple times.