According to its Github repo[1] Patroni is a template for you to create your own customized, high-availability solution using Python and - for maximum accessibility - a distributed configuration store like ZooKeeper, etcd, Consul or Kubernetes. Database engineers, DBAs, DevOps engineers, and SREs who are looking to quickly deploy HA PostgreSQL in the datacenter-or anywhere else-will hopefully find it useful.
This tutorial intends to guide you on how to create the below architecture following all the steps to install and configure all components:
Note that we are using Ubuntu 22 and the Percona Distribution for PostgreSQL 15 in this tutorial but if you want to use the upstream PGDG packages[2] you just need to change the package following what is in PGDG website here[3]. We can find the full documentation in about Percona Distribution for Postgres in Percona's documentation here[4] including instructions to install in other Linux distros like RedHat.
This tutorial will be divided into below steps:
- Initial node setup and install the Repo
- Configure ETCD
- Configure Patroni and PostgreSQL
- Configure HAProxy
- Configure pgBackRest
- Configure connection pooler
- Creating a Standby Cluster
[1] https://github.com/zalando/patroni
[2] https://www.postgresql.org/