After you replicate your ECS instances, create a CLB instance in a region that supports multiple availability zones. You can then add the ECS instances as backend servers to scale out your application's service capacity, eliminate single points of failure, and improve availability. This topic describes how to deploy a CLB instance.
Prerequisites
-
You have replicated three ECS instances. For more information, see Replicate an ECS instance.
-
The web services on all four ECS instances are running correctly.
ImportantIf the web services are not running, the CLB instance cannot communicate with the ECS instances.
Procedure
-
Log on to the Classic Load Balancer (CLB) console and create a CLB instance.
For detailed instructions, see Create a CLB instance.
This tutorial uses the following configurations:
-
Region and Zone: Select the same region as your ECS instances.
-
Zone Type: Select Multiple Zones.
-
Instance Type: Select Private.
-
Network Type: Select VPC.
-
Secondary Zone: Configure as needed.
-
-
Log on to the ECS console and convert the public IP address of the source ECS instance to an EIP.
For detailed instructions, see Convert a static public IP address to an EIP.
NoteTo prevent service interruptions, the IP address of the source instance must remain unchanged. To achieve this, first convert the public IP address of the source instance to an EIP. Then, unbind the EIP from the source instance and associate it with the CLB instance.
-
Unbind the EIP from the source ECS instance.
-
In the IP Address column of the source ECS instance, click the elastic IP address link.
-
On the Elastic IP Address page, find the EIP and click Unbind in the Operation column.
-
Click OK.
For more information, see Unbind an EIP from a cloud resource.
-
-
Log on to the VPC console and associate the EIP with the CLB instance.
-
On the Elastic IP Address page, find the EIP that you just unbound.
-
In the Operation column, click Bind Resources.
-
For Instance Type, select SLB Instance, select the CLB instance that you created, and then click OK.
For more information, see Associate an EIP with a cloud resource.
-
-
Return to the Classic Load Balancer (CLB) console to configure the CLB instance.
For detailed instructions, see Configure a CLB instance.
-
On the Protocol & Listener wizard page, use the following settings.
-
Select Listener Protocol: Select TCP.
-
Listener Port: Enter
80. -
Advanced Configurations in Advanced: Select round-robin.
-
Use the default settings for other parameters.
-
-
Click Next. On the Backend Servers page, select Default Server Group and click Add More.
-
Select the source instance and the three replicated ECS instances, and then click Next.
-
Set Port to 80, keep the default values for other parameters, and click Next.
-
On the Health Check wizard page, use the default settings and click Next.
-
On the Configuration Review wizard page, verify the settings and click Submit.
-
Click OK to return to the Instance Management page.
A health check status of Normal indicates that the backend ECS instances can process requests from the CLB instance.
NoteHealth checks take a few minutes. Wait and refresh the page to view the status.
-
Results
For testing purposes, a static webpage is deployed on each of the four ECS instances to identify them. To test the load balancing, enter the service address of the CLB instance in a web browser. Because the scheduling algorithm is set to round-robin, requests are forwarded to the ECS instances in turn.
Next steps
Use DTS to migrate your self-managed databases from the ECS instances to RDS instances. This ensures business continuity and protects your data with automatic backups. For detailed instructions, see Migrate a self-managed database to a high-availability RDS instance.