High availability and read replicas
How connections, failover and recovery work on a three-node deployment.
One write endpoint, one read endpoint
An HA deployment has one primary and two replicas in the same region. Use the main connection port for writes and immediate read-after-write consistency. The next port serves reads from eligible replicas. Replica reads can lag behind recent changes. All connections require TLS, a database user and an allowed source IP.
What happens when the primary fails
The cluster elects an eligible replacement and routes new connections to it. Existing sessions and open transactions can disconnect. Your application must reconnect and retry transactions safely; do not blindly retry payments or other actions that may already have committed. Losing the cluster majority can stop writes to protect the data.
Durability depends on the engine
PostgreSQL uses strict synchronous quorum replication. MySQL uses single-primary Group Replication. Valkey uses asynchronous replication and Sentinel, so failover can lose recent acknowledged writes. Treat Valkey as a cache or use application-level recovery for data you cannot lose.
Preparing a MySQL schema
MySQL HA requires InnoDB tables with a primary key, or a unique key whose columns cannot be null. Check existing tables before importing an application. Writes to unsupported tables are rejected; add appropriate keys and convert older storage engines first.
Replicas and cloud backups do different jobs
Replicas also receive accidental deletes and bad application writes. Cloud backups remain necessary. After a primary change, a new full backup starts a fresh recovery chain; the available time range shown in Backups is the source of truth. A restore currently creates a separate single-instance copy for validation and leaves the original HA cluster unchanged.
Maintenance and capacity
Compatible updates roll through replicas first, then move writes before updating the former primary. Brief reconnects can still occur. Listed CPU, memory and connection capacity apply per node; usable storage is one copy of the data. HA within one region does not protect against every regional outage.
