High Availability (HA) and Disaster Recovery (DR) are most prominent terms we often hear in cloud computing technologies. To be precise I would say they are not just terms or solutions, they are architectural patterns one should follow to solve mission critical business problems and requirements in a cost effective way. HA deals with the designs one should follow to make their services always available and DR on the other hand is a pattern which deals with recovering or resuming the services in case of failovers. Most of the time both HA and DR are counterparts to one another, which means solving for one would automatically solve the other.
In this tutorial, I am going to specifically show on how to achieve HA on Azure Web roles across data centers. It is a step by step process, please perform below steps in order (as they mentioned).
Step 1 – Create two Cloud Services in US-EAST and US-WEST Data Centers –
Step 2 – Open VS 2013 and create a default MVC application.
Step 3 – Add a cloud services project to the above solution.
Click Cancel when prompted to add a web role project. We are going to add our existing MVC project as a web role.
Right click Roles in the Azure Services project, select Add. Then select “Web Role project in solution”.
Select the MVC project we created in Step (2) and click Ok.
At the end, solution should look like as depicted below.
Step 4 – Deploy the same web application to both Cloud services we created in Step (1).
Right click on the Azure Cloud Services project and then select publish. Import the Azure Subscription publishSettings file. If you don’t have one at hand, download one by visiting this resource – https://windows.azure.com/download/publishprofile.aspx
Click Next. Publish Wizard asks you to create a storage so that the cloud service VHD files can be stored.
Click ok. Select EAST US Service and click next.
On the summary wizard step, cross check all the information and click publish.
NOTE: In the similar way, repeat the same above process for WEST US Data Center Cloud service deployment too.
Step 5 – Create Traffic Manager with both the web roles cloud services as endpoints with FailOver mechanism as default Load Balancing Method. Made West US Web role as primary endpoint too.
Failover priority set would dictate traffic manager the order of precedence for routing the request. Traffic manager always hit the first and primary endpoint, in case of primary endpoint failure, traffic manager falls over to the secondary endpoint and so on. If all the services are offline, traffic manager would route the request to the primary endpoint.
Leave the default monitoring endpoint as it is. Monitoring helps traffic manager to query the health of all the endpoints configured to it. Traffic manager queries the health for every 30secs.
Step 6 –
Now try to hit the traffic manager end point (ha.trafficmanager.net which we created in step (5)) from the Command line prompt. It will take us to our primary endpoint which is US-WEST.
Step 7 –
Now disable West US endpoint in traffic manager, and repeated the same process with cmd. Request will be successfully routed to US-EAST data center.
One has to remember the importance of DNS TTL setting. That setting plays a crucial role in refreshing client side DNS cache which would be required to update the latest traffic manager changes. As per MSDN – “DNS TTL value controls how often the client’s local caching name server will query the Traffic Manager system for updated DNS entries. Any change that occurs with Traffic Manager, such as load balancing method changes or changes in the availability of added endpoints, will take this period of time to be refreshed throughout the global system of DNS servers.”.
This completes our present tutorial. In the next set of tutorials I am going to touch HA & DR concepts of other cloud services and Azure storage.