Designing Highly Available Databases
This lesson explains zone redundancy, active geo-replication and failover groups.
Learning outcomes
After completing this lesson, you will be able to:
- Explain zone redundancy for Azure SQL Database.
- Compare active geo-replication with failover groups.
- Describe high availability for other relational services.
Azure SQL Database in one region
All Azure SQL Database tiers have built-in high availability within a datacenter, and a failed component is replaced automatically. Zone redundancy extends this across availability zones, on General Purpose, Business Critical and Hyperscale, usually with a failover in under 30 seconds and no data loss. It is enabled by a setting, and it suits a requirement to survive a datacenter failure.
Applications should use retry logic, because a brief disconnection accompanies any failover, even a very fast one.
Active geo-replication
Active geo-replication keeps up to four readable secondary databases in the same or other regions, through asynchronous replication. It is configured per database and failed over manually. Secondaries can also serve read queries, which brings the data closer to distant users. Replication is asynchronous, so a forced failover can lose a few seconds of data, and the RPO is greater than zero.
With the Business Critical tier, active geo-replication carries a guaranteed RPO of 5 seconds and RTO of 30 seconds.
Active geo-replication
Failover groups
A failover group manages the replication and failover of a group of databases as a unit, and adds two stable listener endpoints. The read-write listener, fog-name.database.windows.net, always points to the current primary, and the read-only listener, fog-name.secondary.database.windows.net, points to the secondary. Applications connect to the listener, so no connection string needs to change after failover. Since DNS changes take effect through a short TTL, connections move quickly.
Failover groups have two failover policies. Customer-managed is the recommended policy: an operator decides when to fail over, which avoids an unwanted failover with data loss. Microsoft-managed failover is automatic, after a grace period that cannot be set below one hour. Azure SQL Managed Instance supports failover groups but not active geo-replication.
The following comparison summarizes the two features.
The following diagram shows a failover group for related Azure SQL databases across two regions.

Failover groups in practice
Other relational services
SQL Managed Instance has local redundancy, can be zone redundant, and offers failover groups. SQL Server on Azure virtual machines uses Always On availability groups, with synchronous replicas across zones for high availability, and asynchronous replicas to other regions for disaster recovery. This needs Windows Server Failover Clustering and a listener, and it represents more administrative work.
Azure Database for PostgreSQL and MySQL flexible server offer high availability with a standby replica: either zone-redundant, with the standby in another zone, or in the same zone, where zones are unavailable or latency is paramount. Replication is synchronous, so a failover causes no data loss. Read replicas can be promoted, to help with regional recovery.
HA for other relational services
Comparing relational recovery options
The figures below come from Microsoft's business continuity guidance and are typical rather than guaranteed, except where a tier provides a specific guarantee.
| Failure | Feature | Typical RTO | Typical RPO |
|---|---|---|---|
| Zone | Zone-redundant configuration | Under 30 seconds | Zero |
| Region | Failover group or active geo-replication | Under 60 seconds | Zero or more, usually seconds |
| Region, at lowest cost | Geo-restore | Minutes to hours | Minutes to hours |
| Human error | Point-in-time restore | Depends on size | Minutes |
Designing database failover
An order system uses five related Azure SQL databases that must fail over together to a second region, and the application must reconnect without a configuration change. A datacenter failure in the primary region must cause no data loss. The company wants to decide manually when to perform a regional failover. What should you recommend?
A failover group is the right feature, because it fails over all five databases together, and its listeners remove the need for connection string changes. Choosing the customer-managed failover policy satisfies the manual decision requirement.
Zone redundancy should also be enabled on the primary databases, so that a datacenter failure is handled locally without data loss. Active geo-replication by itself would require each database to be failed over separately, with new connection strings. Geo-restore would be much slower, and could lose more data.
Why is a customer-managed failover policy recommended?
Show answer
It lets an operator decide when to fail over, which avoids an unwanted failover and possible data loss.
Exam Tips
Remember for the exam
- Zone redundancy handles a datacenter failure with no data loss.
- Active geo-replication: up to four readable secondaries, per database.
- Failover groups: multiple databases, stable listeners, and SQL Managed Instance support.
- Customer-managed failover is the recommended policy.
- PostgreSQL and MySQL offer zone-redundant or same-zone high availability.