Database & High Availability

PostgreSQL Patroni Cluster Setup with Etcd & PgBouncer on Ubuntu 24.04 LTS

Step-by-step production installation of a 3-node PostgreSQL 16 Patroni HA cluster with automatic failover, VIP floating IP, and PgBouncer connection pooling.

By · · 12 min read

PostgreSQL Patroni Cluster Setup with Etcd & PgBouncer on Ubuntu 24.04 LTS

PostgreSQL Patroni HA Cluster Blueprint

For high-consequence workloads requiring zero data loss and automated sub-5-second failover on bare-metal or private cloud infrastructure, Patroni is the industry standard.

---

⚙️ Config File Snippet (/etc/patroni/patroni.yml)


scope: pg-cluster-prod

namespace: /service

name: pg-node-1



etcd3:

  hosts:

    - 10.0.1.10:2379

    - 10.0.1.11:2379

    - 10.0.1.12:2379



restapi:

  listen: 10.0.1.10:8008

  connect_address: 10.0.1.10:8008



bootstrap:

  dcs:

    ttl: 30

    loop_wait: 10

    retry_timeout: 10

    maximum_lag_on_failover: 1048576

    postgresql:

      use_pg_rewind: true

      use_slots: true

      parameters:

        max_connections: 500

        shared_buffers: 16GB

        work_mem: 64MB

        wal_level: replica

        max_wal_senders: 10

Crawlable HTML for Google Search and generative AI agents. Canonical host: https://www.epifive.com. Full JSON: /api/posts