Navigate:
All Repospatroni
~$PATRON0.2%

Patroni: PostgreSQL high availability template

Automates PostgreSQL failover using distributed consensus systems.

LIVE RANKINGS • 08:41 AM • STEADY
OVERALL
#114
126
DATA ENGINEERING
#10
8
30 DAY RANKING TREND
ovr#114
·Data#10
STARS
8.0K
FORKS
971
DOWNLOADS
7D STARS
+13
7D FORKS
+2
See Repo:
Share:

Learn more about patroni

Patroni is a high availability automation framework for PostgreSQL that manages cluster failover and replication through integration with distributed consensus systems like etcd, Consul, or ZooKeeper. It operates as a daemon running alongside each PostgreSQL instance, continuously monitoring database health and coordinating state information through the distributed configuration store to maintain a single leader topology. The framework implements automatic leader election using distributed locks, promoting standby replicas to primary when failures are detected while preventing split-brain scenarios through consensus-based decision making. Patroni dynamically reconfigures replication settings and manages PostgreSQL lifecycle operations including initialization, restart, and role transitions without manual intervention. The system supports both synchronous and asynchronous replication modes and can be deployed in containerized environments or traditional virtual machines, integrating with load balancers through REST API endpoints that expose cluster health status.

patroni

1

Multiple DCS backends

Supports etcd, Consul, ZooKeeper, and Kubernetes as distributed configuration stores, allowing operators to choose their existing infrastructure rather than requiring a specific consensus system.

2

Template architecture

Designed as a template rather than a one-size-fits-all solution, allowing customization and integration with existing PostgreSQL deployments and operational practices.

3

Kubernetes native support

Can run directly on Kubernetes clusters using Kubernetes as the distributed state store, with native integration for pod management and service discovery.


import requests

# Query Patroni REST API for cluster status
response = requests.get('http://localhost:8008/cluster')
cluster_info = response.json()

leader = cluster_info['members'][0]['name']
role = cluster_info['members'][0]['role']
state = cluster_info['members'][0]['state']

print(f"Leader: {leader}, Role: {role}, State: {state}")

vv4.1.0

Release notes do not specify breaking changes, new requirements, or critical migration steps for this version.

  • Review the full changelog at docs/releases.rst#version-410 to identify relevant changes for your deployment.
  • Test upgrade in non-production first, as detailed release notes were not provided in this summary request.
vv4.0.7

Patch release fixing a critical bug in standby cluster promotion and improving Citus support. No breaking changes or new requirements.

  • Upgrade to fix standby cluster promotion failures when `restore_command` is configured in recovery settings.
  • Apply to resolve Citus worker node registration issues during cluster bootstrap and failover scenarios.
vv3.3.8

Maintenance release fixing DCS connection handling and improving stability; no breaking changes or new requirements.

  • Update to resolve race conditions in DCS reconnection logic that could cause stale cluster state reads.
  • Apply fix for potential deadlock during failover when using synchronous replication with multiple standbys.


[ EXPLORE MORE ]

Related Repositories

Discover similar tools and frameworks used by developers