patroni
PostgreSQL High-Available orchestrator and CLI
What it is and what it does
Patroni is a Python orchestration framework that automates PostgreSQL high-availability cluster management by coordinating replica promotion, failover, and configuration across multiple nodes using a distributed consensus store. It supports PostgreSQL 9.3 to 18 and integrates with etcd, Consul, ZooKeeper, Kubernetes, and Raft as its backing configuration and state store.
You deploy Patroni on each PostgreSQL node in your cluster; it handles leader election, streaming replication setup, and automatic failover when the primary becomes unavailable. It includes HAProxy integration for a single application endpoint and supports both asynchronous and synchronous replication modes. Configuration is YAML-based with environment variable overrides, and the package includes a REST API for monitoring and control.
Use it for:
- Automate failover and replica promotion in multi-node PostgreSQL deployments without manual intervention.
- Manage PostgreSQL cluster state and configuration consistently across nodes using etcd or Consul as a distributed store.
- Integrate PostgreSQL high availability with Kubernetes by running Patroni natively on K8s clusters.
- Set up streaming replication with automatic synchronization and durability guarantees across geographically distributed replicas.
- Monitor and control PostgreSQL cluster health and member status via REST API from external orchestration tools.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Patroni orchestrates PostgreSQL high-availability clusters using distributed configuration stores like etcd, Consul, ZooKeeper, or Kubernetes to manage failover, replication, and cluster state.
Yes. Patroni is production-stable (Development Status 5), actively maintained with recent releases, has no known vulnerabilities, and low install friction. It is the standard choice for PostgreSQL HA orchestration in environments using etcd, Consul, ZooKeeper, or Kubernetes. Install it if you need automated failover and cluster coordination; skip it if you manage PostgreSQL replication manually or use a managed database service.
Install
patroni on PyPI
pip
pip install patroniuv
uv add patronipoetry
poetry add patroniInstalling patroni
Before you install
Low install friction with a pure-Python wheel and eight straightforward runtime dependencies. Actively maintained with a recent release (2 days old) and 8656 GitHub stars, indicating a mature and well-supported project.
License in practice
MIT License (permissive) places no restrictions on use, modification, or redistribution in proprietary or open-source contexts.
Quickstart
pip install patroni[etcd3]
Then configure a postgres0.yml file and run:
./patroni.py postgres0.yml
Patroni will manage PostgreSQL replication and failover via your chosen DCS.
Requires a running distributed configuration store (etcd, Consul, ZooKeeper, or Kubernetes) and a PostgreSQL driver (psycopg, psycopg2, or psycopg2-binary) installed separately.
Verify before relying
- Whether Python 3.11+ memory issue (mentioned in description) affects typical deployments or only those with strict vm.overcommit_memory=2 settings.
- Performance characteristics and scalability limits for clusters beyond three nodes.
- Whether Citus extension integration (noted as available since 3.0) is production-ready or experimental.
Package facts
| License | The MIT License (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 8 — urllib3, PyYAML, py-consul, click, prettytable, python-dateutil, psutil, ydiff |
| Maintenance | actively maintained — 2 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 93,981/month — #13,350 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: patroni-4.1.5-py3-none-any.whl
Keywords: etcd, governor, patroni, postgresql, postgres, ha, haproxy, confd, zookeeper, exhibitor, consul, streaming, replication, kubernetes, k8s
Tags
More Database packages
psycopg2-binary is a PostgreSQL database…
copyleft · top 1,000 on PyPI
redisPython client library for connecting to and…
permissive · top 1,000 on PyPI
ydbYDB Python SDK is the official client library…
permissive · top 1,000 on PyPI
snowflake-connector-pythonConnects Python applications to Snowflake data…
permissive · top 1,000 on PyPI
sqlparsesqlparse tokenizes SQL text into a tree of…
permissive · top 1,000 on PyPI
dbt-adaptersProvides base adapter protocols and shared…
permissive · top 1,000 on PyPI
apache-airflow-providers-postgresIntegrates PostgreSQL databases with Apache…
permissive · top 5,000 on PyPI
testgrestestgres orchestrates temporary PostgreSQL…
unclear · top 15,000 on PyPI
kazooKazoo provides a higher-level Python client API…
permissive · top 5,000 on PyPI
psycopg2-poolManages a pool of reusable PostgreSQL…
copyleft · top 15,000 on PyPI
consulateConsulate is a Python client library for…
permissive · top 15,000 on PyPI
django-db-geventpoolProvides a gevent-based connection pool for…
permissive · top 15,000 on PyPI
python-etcdA Python client library for etcd, a distributed…
permissive · top 15,000 on PyPI
psycopg-poolProvides a connection pool for Psycopg 3,…
copyleft · top 1,000 on PyPI
postgres-mcpA Model Context Protocol server that connects…
permissive · top 15,000 on PyPI
rucio-clientsRucio-clients provides command-line and…
permissive · top 15,000 on PyPI