High availability Postgres, in plain words
What high availability means for a PostgreSQL database, why one computer is not enough, and how CoyoteDB turns your own computers into a Postgres cluster.
High availability means your database keeps answering when something breaks. Not “it never breaks”, but “when one computer stops, the database carries on without it”.
Why one computer is not enough
A database on one computer is only as available as that computer. A dead power supply, a failed disk, a Windows update that reboots at the wrong time, or someone tripping over a cable, and your app has nothing to talk to until that computer is back.
Backups help you get the data back later. They do not keep the app running now.
What a highly available Postgres needs
To keep going when a computer stops, a PostgreSQL high availability setup needs three things:
- More than one full copy of the data, on different computers. CoyoteDB keeps a full copy on every data node. See What “saved on two computers” means.
- A way to decide who is in charge when one of them disappears, without two computers both taking writes. CoyoteDB’s nodes vote. See How automatic failover works.
- A way for your app to find the new main node without changing its settings. CoyoteDB nodes are built to pass connections on to the current main node, so your app can point at any of them. This part is not available yet.
Building that by hand usually means stitching together replication, a failover manager, a consensus store and a connection router, and knowing how they fail. CoyoteDB is built to be the easy way to get a multi-node PostgreSQL database: one small app on each computer, joined with invite codes.
How many computers?
- 1 computer is real Postgres, but not highly available.
- 2 computers keep a live copy, but nothing switches over by itself.
- 2 computers + a witness switch over automatically. This is what we recommend for most people.
- 3 computers switch over automatically and still save to two computers while one is down. We recommend this when the data really matters.
The Node counts explained page goes through each one, and Recommended setups puts them side by side.
Self-hosted, on your own machines
A self-hosted Postgres cluster runs on computers you already have: PCs in an office, mini PCs at home, a couple of small servers. They only need to reach each other over a private network, such as a LAN, Tailscale or a site-to-site VPN. See Running Postgres over Tailscale or a VPN.
For examples of who this is built for, see Use cases. For the whole picture with diagrams, see How it works.