7
votes

We have a geo-replicated database in SQL Azure (Premium) and are wondering if we are pointing to the South Central US database that is the master, if that goes down do we have to manually change our connection strings in our code (C# .Net / Entity Framework 6) to point to the new database in say North US? We are looking for a way to have a single connection string and then Azure do the under the covers to now point to the new database if the master ever goes down. Is that possible?

Update on method followed:
so I read this that we have to manually go into a web.config file on a production system when a region goes down and change the main database to another replicated database that is working.

I decided to just hard code east, west and south regions in the web config and wrote code to retry and fail over to other regions if the main one couldn't be reached. This means it can only read, not write until Microsoft or we manually failover the master to a Read Only Active slave. Not the best experience to me. Requires human intervention knowing it's down, then flipping it and custom code

3

3 Answers

2
votes

You should read this article Designing Cloud Solutions for Disaster Recovery Using Active Geo-Replication

There are a few options on how to setup Azure for availability. So, based on your requirements and configuration, you may need to change SQL Connection String. The key in this article is to look at the "SLA". For example, in Option 2: Active-active compute with decoupled failover, the SLA is:

RTO = SQL connection change + database state change + application verification test

Notice the SQL connection change; this implies a connection string change.

2
votes

Just need to configure "Failover Groups" on the SQL server on Azure, and then configure the group failover R/W listener in the application. It updates the DNS records automatically and points to the available database server in case the former is down due to an outage.

1
votes

Just as an update for someone else who might come looking, this functionality is now available on SQL Azure. It's called auto-failover groups and was announced in May 2017. It is still in preview as of the time of writing - configuration is currently not supported on the portal and must be done via the API.

More information here: https://azure.microsoft.com/en-us/blog/azure-sql-database-now-supports-transparent-geographic-failover-of-multiple-databases-featuring-automatic-activation/