当前位置:网站首页>Play with ECS Lesson 6: introduction to regional deployment and cross zone disaster recovery of elastic computing

Play with ECS Lesson 6: introduction to regional deployment and cross zone disaster recovery of elastic computing

2020-12-07 19:15:44 Aliyun yunqi

Elastic calculation Region Deployment and disaster recovery across availability zones are very complex issues , This sharing is made by Li Zhong, head of Alibaba cloud elastic computing architecture ( Seldon ) How to choose Region, At the same time, combined with Alibaba cloud in Region Practical experience in deployment and cross zone disaster recovery , Share more region How to use the best practices of Alibaba cloud elastic computing in deployment scenarios , Combined with the practical experience of elastic computing, this paper discusses how to realize cross regional disaster recovery based on Alibaba cloud multiple availability zones .

One 、Region And Zone Introduction
This part mainly introduces Region And zones , Including Alibaba cloud construction Region And the reason for availability zones 、 Division, etc .

1.Region( regional ) And Available Zone( Availability zone )

Region( regional ): According to the definition ,Region It's a separate geographic area ,Region Contains multiple Available Zone. Through alicloud Region And the distribution map of available areas .

Available Zone( Availability zone ):Available Zone yes Region An area where the network and electricity are independent of each other , It has two main features . First of all ,Available Zone The network and electricity are independent of each other , With fault isolation capability . When a zone intranet 、 When there's a problem with electricity , It doesn't affect other zones . second , identical Region The intranet interworking between the available zones in , Connect through a high-speed network , Low network latency (ms level ).

There is fault isolation between the zones , At the same time Region The network latency between zones in is low , You can think of multiple zones as providing services as a whole , It also provides a foundation for the subsequent disaster recovery across availability zones .
It needs to be specified here , It's not that regions and availability zones are defined before the construction of high availability services can be supported , It is based on the demand of highly available services Region The resource is divided with availability zone .

2. How to choose Region?

Select a Region There are three important factors :

First of all , Geographical selection needs to be in line with the corresponding policy and legal compliance needs . For example, providing services to the United States , The corresponding data and server resources must be within the country , So according to the bottom Region And availability distribution , You can only apply to Macy 、 Two resources in the United States and East China .
second , According to the functional opening of cloud products in different regions and SLA Choose the right area .
Third , Generally choose the region closer to the user and lower network delay , Ensure fast access for users .

although Region The choice seems to be clause based , But the actual choice is more simple and intuitive , It's easier to get the best choice .

3. Alibaba cloud Region And availability distribution

So far, , Alibaba cloud public cloud construction in the world 21 Regions 63 Usable area , Resources are growing rapidly , The future will support more forms .

The figure below shows Alibaba cloud's ability to provide services in multiple geographical locations around the world , so Region It's a geographical concept . For example, when users are in North China 2( Beijing )Region When you buy resources , Corresponding ECS、RDS The product is really in the territory .

at present Region The distribution of available areas is more concentrated in China , It's also distributed in other countries and regions , In South America and Africa Region Building , It's the direction of follow-up development .

and Region It's a little more complicated to use . With each Region Rendezvous does not use its name directly , But through REGION_ID.REGION_ID It looks messy , In fact, it has certain characteristics , It can be roughly divided into the following three types :

China REGION_ID by cn-( City name ), Such as cn-hangzhou.
Big country REGION_ID by ( Country code )-( bearing )-( Number ), Such as USA-EAST-2.
In other parts of the REGION_ID by ( region )-( bearing )-( Number ).

Two 、Endpoints And resource scope
This section describes the use of Region Two key points need to be paid attention to when using zone :Endpoints And resource scope .

  1. Endpoints

Endpoints Is to call ECS API Access address of .

call ECS API First you need to get Endpoints, That is, you need to know the domain name of the region to be called , To call the corresponding service . Second, we need to have AK, Add some signatures to the call string through a certain alicloud specific algorithm . So you can complete a request .

As shown in the following table , According to the different Region type ,Endpoints There are three ways to access :

The first type is the central domain name Region, Its access point domain name address is ecs.aliyuns.com. Such old regions can only be accessed through the central domain name , Such as cn-beijing.
The second type is Region Domain name , Its access point is Region Change domain name address ecs. R E G I O N I D . a l i y u n s . c o m . this class R e g i o n send use R e g i o n turn Domain name transfer use , and Rong in heart Domain name Pick up Enter into , Such as c n − z h a n g j i a k o u . The first 3、 ... and Kind of class type open beginning Examination Consideration No and Rong in heart Domain name Pick up Enter into Of R e g i o n turn Domain name , only can through too R e g i o n turn Domain name The earth site e c s . {REGION_ID}.aliyuns.com. Such kind Region Use Region Call the domain name , Compatible with central domain name access , Such as cn-zhangjiakou. The third type starts to consider the incompatible central domain name access Region Domain name , Only through Region Change domain name address ecs. REGIONID.aliyuns.com. this class Region send use Region turn Domain name transfer use , and Rong in heart Domain name Pick up Enter into , Such as cnzhangjiakou. The first 3、 ... and Kind of class type open beginning Examination Consideration No and Rong in heart Domain name Pick up Enter into Of Region turn Domain name , only can through too Region turn Domain name The earth site ecs.{REGION_ID}.aliyuns.com Access , Such as cn-heyuan.

For the above three types Region Access to get best practice . Non central domain name region , It is recommended to use Region Change domain name address ecs.${REGION_ID}.aliyuns.com. part Region Only use the central domain name to access , It will switch to Region Domain name .

2. Resource scope

Use ECS There will be a variety of resources in the process , Each resource has a specific scope .

The following table lists some of the resources . Such as account number 、 role 、AK This class is global information , all Region share . example 、 Cloud disk is the concept of zone level , Create examples 、 Cloud disks need to select a specific zone , However, the instance can only mount cloud disks of the same availability zone . snapshot 、 Mirror resources 、keypair、 The scope of security groups is Region, stay Region All available zones within can be accessed . When you need to cross Region Use snapshots 、 When you mirror resources , You need to copy resources first , In another Region Only when new resources are formed can we use them .

Resource scope is not prescriptive , Sometimes there are changes , Most of the time, that's what happened .

3、 ... and 、 Multi zone disaster recovery and Region Chemical deployment
This section describes how to use Region With the availability of regional distribution and Zone Power 、 The characteristics of network fault isolation and low delay realize disaster recovery of multiple availability zones and Region Chemical deployment .

1. Disaster recovery across availability zones —— Cold standby mode

There are two ways of standby , A primary zone runs , One does not run as a backup . Once the running zone service fails , Deploy and run backup zones . The cold standby mode is easier to realize , Its disadvantage is that it takes a lot of time to switch between the master and the standby ( Minutes of class ).

Single zone provides services : As shown in the figure below , Availability zone a And zones b Two sets of services at the same time , Services provided by a single zone . Under normal circumstances, the zone a Provide services , Availability zone b Of ECS Services are not deployed and running , Corresponding SLB No traffic . Flow from DNS Resolve to zone a Of SLB, After the access request SLB It will be distributed to someone ECS.

RDS Active / standby architecture : Two ECS Visit the same RDS,RDS The main / standby structure is adopted , Lord RDS Read and write services , At the same time, there is a path to automatically synchronize data to the standby RDS, Ensure the data consistency and timeliness of the two zones , Provide the basis for disaster recovery switching .

Stateless service :ECS Deploying stateless Services , All business states are stored in or recoverable from the database . Only in this way can the availability zone a In case of failure, the whole business is switched to the availability zone b.

Recovery plan : Availability zone a、b There's electricity 、 Physical isolation of the network , Low latency , In case of zone level failure, the zone can be switched to provide services . Availability zone a When something goes wrong , Deploy and run zones b service ,RDS Active standby switching , Availability zone a Data synchronization can continue after recovery . Switch DNS, Availability zone b SLB Receiving traffic starts to provide services .

Inferiority : The cold standby mode has stronger disaster recovery capability than single availability zone , But its disadvantage is that the switch zone starts ECS、 Start the service, etc 、 function SLB And so on. It takes time , Disaster recovery of minute level .

2. Disaster recovery across availability zones —— Double living mode

The difference between the dual active disaster recovery mode and the cold standby mode lies in the simultaneous operation of the two zones , Data synchronization . Once a zone service fails , Another zone continues to provide services . The dual mode is also easy to implement , Moreover, it takes less time to switch between the master and the standby (s level ).

Dual zones provide services at the same time : As shown in the figure below , There are zones a And zones b Two sets of services at the same time .SLB Mount two zones at the same time ECS service , For each zone SLB The request needs to be distributed to the ECS.

RDS Active / standby architecture : Automatically synchronize data , Ensure the data consistency and timeliness of the two zones . Under normal circumstances, both Zone Services Access RDS Master node .

Stateless service :ECS Deploying stateless Services , All business states are stored in or recoverable from the database .

Recovery plan : When a zone goes wrong ,RDS It can automatically switch between main and standby .DNS Time detection SLB state , Shield fault zone ,SLB Time detection ECS Service status , Shield fault service . In this scenario, most of the detection is implemented automatically , In some complex scenarios, it may be necessary to manually confirm the fault , But the switch is fast , Second level switching can be realized .

The above two methods are more practical 、 common , All available areas are available for network implementation 、 Physical isolation of power and low delay characteristics .

3. Span Region Deploy

Here we only introduce a simple cross Region Deployment mode .

First of all, divide the region .Region After the deployment is completed , Every Region High availability is guaranteed by the cluster of disaster recovery zone in . But when the client calls the region, it is Region Cannot support all users and resource access . Therefore, first of all, we need to divide the users or resources according to their regions , adopt DNS Service acquisition Region Address . The DNS It may be services provided by alicloud or other services ,DNS According to the user or resource, return the corresponding Region Address .

For example, a user visits Region 1, Call Region 1 The service of the company provides corresponding support , A user visits Region 2, Call Region 2 The service of the company provides corresponding support .

Region Disaster recovery in dual zone . After the geographical division is completed , When zone level issues expand to Region Level problem scenario , Not provided Region Level disaster recovery capability , But it provides isolation . For example, when Region1 Something's wrong , Can't switch to Region2 Disaster recovery , But isolation can be achieved , When Region 1 When something goes wrong Region 2 Unaffected , That is, the ability to save part of the work service .

If you need to provide Region Level disaster recovery capability , Need to achieve cross Region Data synchronization or replication of , Will a Region The data of 、 Copy user status etc. to another Region, That is to say Region Switch . It's going to be more complicated .Region Level disaster recovery and other complex solutions are not introduced here , If you are interested, you can check the information by yourself .

Failure impact and recovery . The disaster recovery method that users finally choose 、 Fault isolation level 、 Fault recovery solutions need to be based on their own business needs 、 The realization difficulty and failure probability are judged , Choose the best solution for your business .

in summary , This sharing introduces Region、 Definition of availability zone 、 Fault isolation and low delay characteristics 、 Key points and basic concepts such as cross availability disaster tolerance . You can use alicloud's infrastructure and corresponding business support to improve service availability , Disaster recovery at a certain level , Provide better service .

Interested students can learn different cross zone disaster recovery solutions in more specific scenarios , Learn more about Cross Region disaster .

Link to the original text
This article is the original content of Alibaba cloud , No reprint without permission .

版权声明
本文为[Aliyun yunqi]所创,转载请带上原文链接,感谢
https://chowdera.com/2020/11/20201112221016701h.html