Pcornel
Databases · Microsoft SQL Server

Always On Availability Groups

Cheat sheet · https://pcornel.dk/topic.php?topic=6199

Back to the Topic

Answer

SQL Server Always On Availability Groups replicate databases to secondary replicas (sync or async) with automatic failover and a listener name for clients, on top of Windows Server Failover Clustering (or Pacemaker on Linux).

Remember

Synchronous commit for automatic failover; async for distance. Check synchronization health, queue sizes and the listener. Log can't truncate while a replica lags.

First checks

  • SELECT * FROM sys.dm_hadr_database_replica_states; — first check for this topic
  • psql -c "SELECT now(), version();" — PostgreSQL reachable and version
  • mysql -e "SELECT NOW(), VERSION();" — MariaDB/MySQL reachable and version
  • sqlcmd -S <server> -Q "SELECT @@VERSION" — SQL Server reachable and version

Verify in this order

primary log → sent to secondaries → hardened/redone → failover via cluster → listener

Where it usually breaks

A large redo queue makes failover slow.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=6199

Confirmation

Confirm action

Continue?