# patroni/patroni

A template for PostgreSQL High Availability with Etcd, Consul, ZooKeeper, or Kubernetes

Repository: https://github.com/patroni/patroni
Canonical: https://ross.abutalabs.com/products/patroni
Language: Python
License: MIT
License Family: permissive
Topics: postgresql, high-availability, etcd, zookeeper, consul, raft, failover, haproxy, kubernetes
Last push: 2026-08-26T18:40:01+00:00

## Health v2 (maintenance only)
Score: 98/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 99, release rhythm 97, longevity 100
- inputs: {"age_days": 4074, "days_push": 7, "days_rel": 21, "gap_med": 0.0, "n_releases_24m": 25}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 8683, forks 1019 (observed 2026-08-28T04:10:24.220488+00:00)

## What it is
Patroni is a Python-based high-availability orchestrator for PostgreSQL clusters that automates leader election, failover, and replication management. It integrates with distributed configuration stores such as etcd, ZooKeeper, Consul, Kubernetes, and Raft to coordinate cluster state.

## Use cases
- set up a highly available postgresql cluster with automatic failover
- run postgres on kubernetes with leader election and failover
- manage streaming replication and switchover for postgres
- replace manual postgres failover scripts with automated cluster management
- deploy postgres HA with etcd or consul as the consensus store
- orchestrate postgres clusters behind haproxy with health-based routing

## When to choose
- you need automated failover and leader election for postgresql
- you run postgres on kubernetes or use etcd/consul/zookeeper for coordination
- you want a battle-tested, actively maintained HA solution with a large community

## When to avoid
- you run a single postgres instance and don't need high availability
- you use a database other than postgresql
- you want a fully managed database service rather than self-managed orchestration

## Facets
- artifact type: application
- maturity: active
- function: database, deployment, monitoring, cli
- domain: databases, self-hosted, microservices
- platform: python, self-hosted
- tags: postgresql, high-availability, failover, orchestration, replication, etcd, consul, zookeeper, haproxy, devops, linux, macos, docker, kubernetes

## Member repositories
- patroni/patroni (main) score 98

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:10:24.220488+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T17:25:35.665945+00:00, confidence not recorded.
  - readme: https://github.com/patroni/patroni (fetched 2026-08-28T04:10:24.220488+00:00, sha bf86595f3705)
  - registry_pypi: https://pypi.org/pypi/patroni/json (fetched 2026-08-29T08:25:55.449605+00:00, sha cdd62e7c0734)
- Data as of 2026-08-30T08:39:29.467469+00:00.
