All Products
Search
Document Center

Elastic Compute Service:configure a CLB instance

Last Updated:Mar 20, 2024

After you replicate Elastic Compute Service (ECS) instances to multiple zones, you can create a multi-zone Classic Load Balancer (CLB) instance in a region that supports multiple zones and associate the ECS instances from different zones with the CLB instance. This way, you can extend the external service capabilities of application systems, eliminate single points of failure, and improve the availability of application systems. This topic describes how to deploy a CLB instance.

Prerequisites

  • Three ECS instances are created by replicating a source ECS instance. For more information, see Replicate ECS instances.

  • The web services of the four ECS instances are started and run as expected.

    Important

    If the web service of an ECS instance does not run, the ECS instance cannot communicate with a CLB instance.

Procedure

  1. Log on to the CLB console and create a CLB instance.

    For more information, see Create a CLB instance.

    Configure the following parameters for the CLB instance:

    • Region: Select the region where the ECS instances reside.

    • Zone Type: Select Multi-zone.

    • SLB instance: Select Intranet.

    • Network Type: Select VPC.

    • Backup Zone: Configure a zone based on your business requirements.

  2. Log on to the ECS console and convert the public IP address of the source ECS instance to an elastic IP address (EIP).

    For more information, see Convert the public IP address of an ECS instance in a VPC to an EIP.

    Note

    To prevent business from being affected, make sure that the IP address of the source ECS instance remains unchanged. Convert the public IP address of the source ECS instance into an EIP, disassociate the EIP from the source ECS instance, and then associate the EIP with the multi-zone CLB instance.

  3. Disassociate the EIP from the source ECS instance.

    1. In the IP Address column that corresponds to the source ECS instance, click the EIP.

      image

    2. On the Elastic IP Addresses page, find the EIP that you want to disassociate and click Disassociate from Resource in the Actions column.

    3. Click OK.

      For more information, see Disassociate an EIP from a cloud resource.

  4. Log on to the VPC console and associate the EIP with the CLB instance.

    1. On the Elastic IP Addresses page, find the EIP that is disassociated from the source instance.

    2. In the Actions column, click Associate with Resource.

    3. Select SLB Instance from the Instance Type drop-down list, select the CLB instance that you created, and then click OK.

      For more information, see Associate an EIP with an ECS instance.

  5. Go back to the CLB console and configure the CLB instance.

    For more information, see Configure a CLB instance.

    Perform the following steps to configure the basic settings:

    1. In the Protocol & Listener step of the Configure Server Load Balancer wizard, configure the following parameters:

      • Select Listener Protocol: Select TCP.

      • Listener Port: Enter 80.

      • Scheduling Algorithm in the Advanced Settings section: Configure this parameter based on your business requirements. In this example, Round Robin is selected.

      • Use the default values for the other parameters.

    2. Click Next. In the Backend Servers step, select Default Server Group and click Add More to add ECS instances.

    3. Select the source instance and the three replicated ECS instances, and click Next.

    4. Set Port to 80 and use the default values for other parameters. Click Next.

    5. In the Health Check step, use the default values and click Next.

    6. In the Confirm step, verify the information and click Submit.

    7. Click OK to go back to the Instances page.

      If Healthy is displayed in the Port/Health Check/Backend Server column that corresponds to the CLB instance, the ECS instances in the default server group of the CLB instance work as expected and can receive requests that are forwarded by the CLB instance.

      Note

      The health check requires a few minutes to complete. Wait until the health check is complete and refresh the page to check the Health Check value.

Result

In this topic, a static web page is built on each of the four ECS instances to identify each instance. Enter the IP address of the CLB instance in the address bar of a browser to test the load balancing performance of the instance. Requests are distributed to the ECS instances in turn because Scheduling Algorithm is set to Round Robin for the listener.

What to do next

Use Data Transmission Service (DTS) to migrate a self-managed database from an ECS instance to an ApsaraDB RDS instance. Make sure that the database is not interrupted during migration and data is automatically backed up. For more information, see Migrate self-managed databases to ApsaraDB RDS instances that run RDS High-availability Edition.