tezvyn:

Database High Availability: Surviving Server Failure

AI-drafted, machine-checkedSource: Wikipedia: High-availability clusteradvanced

High Availability (HA) means having a hot standby database ready to take over instantly upon failure. It's essential for critical systems like payment gateways where downtime is unacceptable.

WHY IT EXISTS A single database server is a critical point of failure for most applications. If that server crashes due to hardware or software issues, the entire service becomes unavailable until an administrator manually intervenes. High Availability was created to eliminate this downtime by automating recovery.

THE MENTAL MODEL Think of a lead pilot and a co-pilot in an airplane cockpit. Both are fully capable of flying the plane. If the lead pilot becomes incapacitated, the co-pilot immediately takes control without passengers even noticing. In a database HA cluster, one server is the "active" pilot, and one or more "standby" servers are the co-pilots, ready to take over instantly.

HOW IT WORKS HA systems use specialized software to constantly monitor the health of the primary database server, often via a "heartbeat" signal. If this signal is lost, the software assumes the primary has failed and triggers a failover process. First, it ensures the old primary is truly offline to prevent a "split-brain" where two servers think they are in charge. Second, it promotes a standby node to become the new primary. This involves reconfiguring network routes and potentially mounting storage so that application traffic is seamlessly redirected to the new, healthy server.

WHEN TO USE IT Implement HA for mission-critical databases where uptime is paramount and downtime is measured in lost revenue or user trust. This applies to online transaction processing (OLTP) systems, e-commerce platforms, financial services, and any application with a strict Service Level Agreement (SLA) promising 99.99% uptime or higher.

WHEN NOT TO USE IT HA adds significant operational complexity and infrastructure cost. It's often unnecessary for development environments, internal analytics platforms, or non-critical applications where a manual recovery process taking minutes or hours is acceptable. If your Recovery Time Objective (RTO) is flexible, a simpler backup-and-restore strategy may be sufficient.

ONE CANONICAL EXAMPLE A classic active-passive PostgreSQL cluster. The active node handles all reads and writes. A second, passive standby server receives all data changes from the primary via streaming replication. Monitoring software like Patroni detects if the active node goes down. It then automatically promotes the standby to become the new active node and reconfigures the application's connection endpoint, typically completing the failover in under 30 seconds.

Read the original → en.wikipedia.org

Get five bites like this every day.

Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.