Article Directory
Introduction and construction of load balancing
Introduction
Server Load Balancer is a traffic distribution control service that distributes access traffic to multiple back-end cloud servers (ECS instances) according to a forwarding strategy. Load balancing expands the service capabilities of applications and enhances the availability of applications.
Load balancing virtualizes the added ECS instances into a high-performance and highly available application service pool by setting virtual service addresses , and distributes requests from clients to ECS instances in the cloud server pool according to forwarding rules.
Load balancing checks the health status of ECS instances in the cloud server pool by default, automatically isolates ECS instances in abnormal states, eliminates the single point of failure of a single ECS instance, and improves the overall service capability of the application. In addition, load balancing also has the ability to resist DDoS attacks, which enhances the protection capabilities of application services.
Architecture
Load balancing services mainly have three core concepts:
Server Load Balancer instances
A load balancing instance is a running load balancing service that receives traffic and distributes it to back-end servers. To use the load balancing service, you must create a load balancing instance and add at least one monitor and two ECS instances.
Listeners
The listener is used to check the client request and forward the request to the back-end server. The monitoring will also perform a health check on the back-end server.
Backend Servers
A group of ECS instances that receive front-end requests. You can add ECS instances to the server pool individually, or you can add and manage them in batches through virtual server groups or active/standby server groups.
Features
1) Load balancing service virtualizes multiple cloud server (Elastic Compute Service, ECS) resources located in the same region (Region) into a high-performance and highly available application service pool by setting virtual service addresses (IP); Distribute network requests from clients to the cloud server pool in a specified way.
2) The load balancing service will check the health status of the ECS in the cloud server pool, and automatically isolate the abnormal ECS, thereby solving the single point problem of a single ECS and improving the overall service capability of the application. In addition to the standard load balancing function, the load balancing service also has the characteristics of TCP and HTTP anti-DDoS attacks, which enhances the protection capabilities of the application server.
3) Load balancing service is a supporting service of ECS for multi-machine solutions, and it needs to be used in conjunction with ECS.
Product advantages
-
High availability
Fully redundant design, no single point, supports disaster recovery in the same city. With DNS, it can achieve cross-regional disaster recovery, and the availability is as high as 99.95%.
Flexible expansion based on application load, without interrupting external services in the case of traffic fluctuations.
-
Scalable
You can increase or decrease the number of back-end servers at any time according to your business needs to expand the service capabilities of your application.
-
low cost
Compared with the high investment of traditional hardware load balancing systems, the cost can be reduced by 60%.
-
Safety
Combined with Cloud Shield, it can provide 5Gbps anti-DDOS attack capability.
SLB load balancing construction
Cloud server status confirmation
Configure more than two cloud servers for external network access, and self-verification can be accessed normally
Load balancing configuration
Mount the two servers to the backend of the load balancing, so that users only need to access one IP address or domain name, and the load balancing server will automatically forward user requests to the corresponding backend server according to the weight.
Log in to the Alibaba Cloud Management Console
Click on the left navigation bar of products and services , drop-down menu, the elastic computing to select the next entry load balancing
Click on the left of the instance management , and open the example experiment provided, in the instance list page, click on the right side of the goal instance point I began to **** configuration .
If the instance configuration column is empty, please try to change the area in the upper page column
By load balancing services configuration wizard, configure load balancing listening port , the back-end server and the health check :
In agreement & monitor page, enter the following information is complete, click Next .
- Load balancing protocol: select HTTP
- Listening port: set to 80
- Advanced configuration keep the default
In the back-end server page, listens for requests forwarded to the default server group , the server has been added at the click Continue **** added .
[External link image transfer failed. The source site may have an anti-hotlinking mechanism. It is recommended to save the image and upload it directly (img-nAI2kY4l-1601039877329) (D:\Note\ALiCould seven-day ECS training notes\day3\3-1 to create a load balancer .png)]
On the Add Server Pages to be, tick in front of two pre-configured cloud server, and then click Next , then click Add ;
In Configuration Audit page, confirm the correct operation of the above configuration, click submit ; the following dialogue appears, indicating successful configuration, click the know ;
Then yes to the end
New page in a browser, and access the load balancing of service address (elastic address)
Weight configuration
Click on the left side of the console instance management , red box on the right side of the page to see the load balancing instance name (ie cloud products and resources provided by load balancing of IP addresses );
Select After entering the default server group ; [Picture dump outside the chain fails, the source station may have a security chain mechanism, it is recommended to save the pictures uploaded directly down
All checked, select to modify the weights , two instances weights were 30 , 90 . Then keep Yes
When users access through load balancing, 1/4 of the user requests are sent to one back-end server, and 3/4 of the requests are sent to another back-end server.
Session retention
Select monitor, choose to modify monitor configuration during operation
After entering, select advanced settings. Open the session to maintain. Always Yes
In the server, 3/4 of the request is sent to another back-end server.
Session retention
Select monitor, choose to modify monitor configuration during operation
After entering, select advanced settings. Open the session to maintain. Always Yes