Registry / database / patroni

patroni

JSON →
library4.1.3pypypi✓ verified 84d ago

Patroni is a Python-based orchestrator for managing high-availability PostgreSQL clusters using Distributed Configuration Stores (DCS) like etcd, Consul, ZooKeeper, or Kubernetes. Current version is 4.1.2. It follows a rapid release cadence with frequent minor and patch releases.

pip install patroni
INSTALL
IMPORT
SIG · PATRONI
P
patroni
databasepythonv4.1.3
Install
4.3s avg
Import
—
Disk
34MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v4.1.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 37.5MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 4.3s · import 0.000s · 39MB
34MB installed
● package 34MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Patroni
✓ import patroni
✗ from patroni import Patroni

Minimal Patroni instance using etcd as DCS. Adjust listen addresses, credentials, and PostgreSQL paths.

from patroni import Patroni config = { 'namespace': '/service/', 'scope': 'batman', 'name': 'postgresql0', 'restapi': {'listen': '0.0.0.0:8008', 'connect_address': '127.0.0.1:8008'}, 'etcd': {'host': '127.0.0.1:2379'}, 'bootstrap': { 'dcs': {'ttl': 30, 'loop_wait': 10, 'retry_timeout': 10, 'maximum_lag_on_failover': 1048576}, 'initdb': [{'encoding': 'UTF8'}, {'data-checksums': 'true'}], 'pg_hba': ['host replication replicator 127.0.0.1/32 md5', 'host all all 0.0.0.0/0 md5'], 'users': {'admin': {'password': 'admin', 'options': ['createrole', 'createdb']}} }, 'postgresql': { 'listen': '0.0.0.0:5432', 'connect_address': '127.0.0.1:5432', 'data_dir': 'data/postgresql0', 'bin_dir': '/usr/lib/postgresql/14/bin', 'pgpass': '/tmp/pgpass', 'authentication': {'replication': {'username': 'replicator', 'password': 'rep-pass'}, 'superuser': {'username': 'postgres', 'password': 'secret-password'}}, 'parameters': {'unix_socket_directories': '.'} }, 'tags': {'nofailover': False, 'noloadbalance': False} } patroni = Patroni(config) patroni.run()
patroni --version
Debug
Known issues
breakingPatroni v4.x drops support for Python 3.6/3.7. Requires Python 3.8+.
fix
Upgrade Python to 3.8 or higher.
affects: >=4.0.0
gotchaRunning multiple Patroni instances with identical config name can cause split-brain. Each node must have a unique 'name'.
fix
Ensure 'name' in config is unique per node (e.g., postgresql0, postgresql1).
affects: all
deprecatedOld DCS configuration keys like 'etcd2' and 'consul' changed to 'etcd' and 'consul' with different structure in v3.0+. 'etcd2' is removed in v4.x.
fix
Use 'etcd' key instead of 'etcd2'. Refer to docs for the new format.
affects: >=4.0.0
gotchaSystemd unit files shipped with earlier versions may not restart Patroni automatically on failure. In v4.x, the recommended unit is 'patroni.service' with Restart=always.
fix
Update systemd unit to include Restart=always or use the template from the official repository.
affects: <4.0.0
breakingConfiguration option 'postgresql.bin_dir' is now required in v4.x if psql is not on PATH.
fix
Set 'postgresql.bin_dir' to the directory containing PostgreSQL binaries (e.g., /usr/lib/postgresql/14/bin).
affects: >=4.0.0
Upgrade
Version history
4.1.3latest on PyPI · released May 5, 2026
Audit
Dependencies
psycopg2-binaryrequiredRequired for PostgreSQL connectivity.
python-etcdoptionaletcd DCS support (optional if using other DCS).
python-consuloptionalConsul DCS support (optional).
kazoooptionalZooKeeper DCS support (optional).
pysyncobjoptionalRAFT consensus (optional, for standalone).
Agent activity
55 hits · last 30 days
node
50
OpenAI (training)
1
Resources
patroni — pip install patroni · libregistry