DatabaseDevOps

Postgres: Self-Hosting a High-Availability Postgres DB Must Not Be Intimidating

Sarah Jenkins
Sarah Jenkins
Senior Database Engineer::Oct 24, 2023

Running a database in production is scary. Running it with High Availability (HA) requirements can be terrifying. But it doesn't have to be.

When we talk about HA in the context of Postgres, we're essentially trying to solve one problem: Single Point of Failure. If your primary node goes down, your app goes down.

> The Architecture

We recommend a setup managed by Patroni. Patroni is an open-source tool that manages PostgreSQL configurations and handles failovers.

scope: postgres-ha-cluster
namespace: /db/
restapi:
  listen: 0.0.0.0:8008
etcd:
  host: 10.0.0.1:2379

Self-hosting gives you complete control over your data. While managed services are great, understanding the underlying HA architecture makes you a better engineer.