This topic describes how to configure an SLB instance. After you create an SLB instance, you must add at least one listener and a group of backend servers to this SLB instance so that it can forward traffic. The following example sets up a TCP listener and adds two ECS instances (ECS01 and ECS02) that host static web pages as backend servers to an SLB instance.
- Log on to the SLB console.
- On the Server Load Balancers page, find the target SLB instance and click Configure Listener in the Actions column.
- In the Protocol and Listener step, complete the following information and use the default values for other fields
to configure the listening rule.
- Select Listener Protocol: Select a listener protocol. In this example, select TCP.
- Listening Port: Set a frontend port to receive and forward requests to backend servers.
In this example, set the port number to 80.
- Enable Peak Bandwidth Limit: You can switch on this option and then set a bandwidth limit to control the bandwidth
that is used by the applications running on backend servers to provide external services.
In this example, the SLB instance incurs fees based on the amount of transmitted data, not on the bandwidth. Therefore, the bandwidth limit is not set.
- Scheduling Algorithm: Select a scheduling algorithm for distributing requests to backend servers. SLB
supports the following scheduling algorithms. In this example, select Round-Robin (RR).
- Weighted Round-Robin (WRR): Requests are distributed proportionally based on the assigned weights of backend servers. Backend servers with higher weights receive more requests.
- Weighted Least Connections (WLC): Requests are distributed based on the combination of the weights and active connections of backend servers. If multiple backend servers have the same weight, requests are routed to the backend server with the lowest number of active connections.
- Round-Robin (RR): Requests are evenly and sequentially distributed to backend servers.
- Click Next. In the Backend Servers step, select Default Server Group and click Add More to add backend servers.
- In the Select Servers dialog box, select the previously created ECS01 and ECS02 instances and click Next.
- Configure the weights of the ECS instances.The higher the weight, the more requests a backend server receives. The default weight is 100. We recommend that you use the default value.
- Click Add.
- In the Default Server Group section, specify backend server ports.A backend server uses this port to receive requests. You can specify the same port for multiple backend servers of an SLB instance. In this example, set the port number to 80.
- Click Next to configure the health check. The default health check settings are used in this
After you enable the health check feature, when a backend server is detected unhealthy, SLB bypasses requests from this backend server to other healthy backend servers. SLB will only send requests to this backend server when it has been restored and is considered healthy.
- Click Next. In the Submit step, check the configuration and click Submit.
- Click OK to go back to the Server Load Balancers page, and click to refresh the page.
If the health check state of a backend ECS instance is Active, the backend server is working properly and is able to process requests.
- In the web browser, enter the service IP address of the SLB instance in the address
box to test network load balancing.