Patroni: PostgreSQL high availability template
Automates PostgreSQL failover using distributed consensus systems.
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.
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.
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.
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}")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.
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.
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.
Top in Data Engineering
Related Repositories
Discover similar tools and frameworks used by developers
exceljs
Parse, modify, and generate XLSX files in Node.js.
redis-py
High-performance, feature-rich Python interface for Redis in-memory data store with support for clustering, pipelines, and async operations.
ioredis
Robust TypeScript Redis client supporting clusters and Sentinel.
HikariCP
Zero-overhead JDBC connection pooling for production Java applications.
superset
Flask-based BI platform for SQL database visualization.