All Products
Search
Document Center

Server Load Balancer:Create and manage a primary/secondary server group

Last Updated:Oct 07, 2023

A primary/secondary server group consists of a primary server and a secondary server. After you select a primary/secondary server group for a listener, requests are forwarded to the primary server when the primary server works as expected. If the primary server fails, requests are forwarded to the secondary server. The time when the system switches to the secondary server is determined by the timeout period for health checks. Requests are automatically forwarded to the primary server when it recovers.

Important

Only TCP and UDP listeners support primary/secondary server groups.

Prerequisites

  • A Classic Load Balancer (CLB) instance is created. For more information, see Create and manage CLB instances.

  • Elastic Compute Service (ECS) instances are created and applications are deployed on the ECS instances to receive requests. For more information, see the following topics:

    Note

    Make sure that the ECS instances and the CLB instance are deployed in the same region.

Create a primary/secondary server group

  1. Log on to the CLB console.
  2. In the top navigation bar, select the region where the CLB instance is deployed.

  3. On the Instances page, click the ID of the CLB instance that you want to manage.

  4. Click the Primary/Secondary Server Groups tab.

  5. On the Primary/Secondary Server Groups tab, click Create Primary/Secondary Server Group.

  6. On the Create Primary/Secondary Server Group page, set the parameters.

    1. In the Primary/Secondary Server Group Name field, enter a name for the primary/secondary server group.

    2. Enter a tag key in the Tag Key field and a tag value in the Tag Value field.

    3. In the Selected Servers section, click Add.

  7. In the Servers panel, select the servers that you want to add. Click Next.

    Note

    You can add only two backend servers to a primary/secondary server group.

    If you want to select an elastic network interface (ENI), make sure that the ENI is attached to the ECS instance. For more information, see Add backend servers by specifying ENIs.

  8. In the Ports/Weights step, configure the ports and click Add.

    You can click Add Port in the Actions column to add more ports.

  9. On the Create Primary/Secondary Server Group page, select a server in the Server Type column as the primary server.

  10. Click Create. In the message that appears, click OK.

    Layer 7 listeners cannot forward requests to primary/secondary server groups. After you create a primary/secondary server group, you can perform the following operations:

    • Add a TCP listener, and select the primary/secondary server group. For more information, see Add a TCP listener.

    • Add a UDP listener, and select the primary/secondary server group. For more information, see Add a UDP listener.

Delete a primary/secondary server group

If you no longer use a primary/secondary server group, you can delete the primary/secondary server group. Before you delete a primary/secondary server group, you must disassociate the server group from all listeners.

  1. Log on to the CLB console.
  2. In the top navigation bar, select the region where the CLB instance is deployed.

  3. On the Instances page, click the ID of the CLB instance that you want to manage.

  4. Click the Primary/Secondary Server Groups tab.

  5. On the Primary/Secondary Server Groups tab, find the primary/secondary server group that you want to delete and click Delete in the Actions column.

  6. In the message that appears, click OK.