Lesson 3 of 4 High Availability Solutions

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.

True or false

Active geo-replication

Exam skills 3.2.2

Check the behaviour of active geo-replication.

Log in to try this activity Interactive activities are free with an account.

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.

Active geo-replication
ScopeOne database
Applies toAzure SQL Database
Stable endpointsNo
SecondariesUp to four
Choose when Several readable replicas per database
Failover groups
ScopeGroup of databases
Applies toAzure SQL Database and Managed Instance
Stable endpointsYes, read-write and read-only listeners
SecondariesOne, in normal production use
Choose when Coordinated failover with no connection string change

The following diagram shows a failover group for related Azure SQL databases across two regions.

A failover group for five related Azure SQL databases. Its listener keeps the connection string unchanged, the customer-managed failover policy leaves the regional decision to the company, and zone redundancy in the primary region handles a datacenter failure locally with no data loss.
The scenario is illustrative.
Scenario questions

Failover groups in practice

Exam skills 3.2.2

Apply failover groups to multi-database applications.

Log in to try this activity Interactive activities are free with an account.

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.

Match the pairs

HA for other relational services

Exam skills 3.2.2

Match each relational service with its high availability mechanism.

Log in to try this activity Interactive activities are free with an account.

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.

FailureFeatureTypical RTOTypical RPO
ZoneZone-redundant configurationUnder 30 secondsZero
RegionFailover group or active geo-replicationUnder 60 secondsZero or more, usually seconds
Region, at lowest costGeo-restoreMinutes to hoursMinutes to hours
Human errorPoint-in-time restoreDepends on sizeMinutes
Worked example

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.

Check yourself

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.