Before you use Classic Load Balancer (CLB), you must add backend servers to receive the requests forwarded by CLB.
CLB uses virtual IP addresses to distribute network traffic across groups of backend servers in the same region to ensure high performance and high availability. You can also use vServer groups and primary/secondary server groups to manage backend servers. You can associate listeners with different server groups. This way, CLB can distribute requests to backend servers that use different ports in different server groups.
If you associate a listener with a vServer group or a primary/secondary server group, the listener distributes requests to the backend servers in the vServer group or primary/secondary server group instead of the backend servers in the default server group.
You can add backend servers to or remove backend servers from a CLB instance anytime. You can also switch traffic from one backend server to another. To ensure the stability of services, make sure that the health check feature is enabled and that at least one backend server is healthy before you perform the preceding operations.
When you add backend servers, take note of the following items:
By default, CLB does not support cross-region deployment. Make sure that the backend servers and the CLB instance belong to the same region. If your CLB instance is deployed in a virtual private cloud (VPC), you can add only backend servers that belong to the same VPC to a CLB server group.
Each CLB listener serves a backend application. CLB uses listener ports to receive client requests and forward the requests to backend ports that are used by the applications on backend servers.
You can specify a weight for each backend server in a server group. A backend server that has a higher weight receives more requests.
If session persistence is enabled, requests may be unevenly distributed to backend servers. We recommend that you disable session persistence and check whether the issue persists.
If requests are unevenly distributed, troubleshoot the issue by performing the following steps:
Count the number of access log entries generated on each backend server within a specific time period.
Check whether the number of access log entries varies by backend server and whether the number is consistent with the configuration of the CLB instance. If session persistence is enabled, you must exclude access log entries that contain the same IP address. If the backend servers have different weights, check whether the numbers of access log entries are weighted.
If a backend Elastic Compute Service (ECS) instance performs hot migration, persistent connections to CLB may be closed. Make sure that the automatic reconnection mechanism is configured for your applications.
Default server group
If no vServer group or primary/secondary server group is specified for a listener, the listener forwards all requests to the backend servers in the default server group. For more information, see Add and manage backend servers in the default server group.
You can create vServer groups for CLB to distribute different requests to different backend servers. To allow CLB to distribute requests based on domain names and URLs, you can specify vServer groups in domain name-based forwarding rules and URL-based forwarding rules. For more information, see Create and manage vServer groups.
Primary/secondary server group
A primary/secondary server group contains only two backend servers. One backend server serves as the primary server and the other backend server serves as the secondary server. CLB does not perform health checks on the secondary server in a primary/secondary server group. If the primary server is down, network traffic is automatically distributed to the secondary server. When the primary server recovers, traffic is switched back to the primary server. For more information, see Create and manage a primary/secondary server group.
You can add primary/secondary server groups only to TCP and UDP listeners.