# Introduction

Patroni is a template for high availability (HA) PostgreSQL solutions using Python. For maximum accessibility, Patroni supports a variety of distributed configuration stores like ZooKeeper, etcd, Consul or Kubernetes. Database engineers, DBAs, DevOps engineers, and SREs who are looking to quickly deploy HA PostgreSQL in datacenters — or anywhere else — will hopefully find it useful.

We call Patroni a “template” because it is far from being a one-size-fits-all or plug-and-play replication system. It will have its own caveats. Use wisely. There are many ways to run high availability with PostgreSQL; for a list, see the PostgreSQL Documentation.

Currently supported PostgreSQL versions: 9.3 to 18.

Note to Citus users: Starting from 3.0 Patroni nicely integrates with the Citus database extension to Postgres. Please check the Citus support page in the Patroni documentation for more info about how to use Patroni high availability together with a Citus distributed cluster.

Note to Kubernetes users: Patroni can run natively on top of Kubernetes. Take a look at the Kubernetes chapter of the Patroni documentation.

Contents:

- Introduction
  - Development Status
  - Technical Requirements/Installation
  - Planning the Number of PostgreSQL Nodes
  - Running and Configuring
  - YAML Configuration
  - Environment Configuration
  - Replication Choices
  - Applications Should Not Use Superusers
  - Testing Your HA Solution
- Installation
  - Pre-requirements for Mac OS
  - Psycopg
  - General installation for pip
  - Package installation on Linux
  - Upgrading
- Patroni configuration
  - Important rules
  - Configuration generation and validation
- Patroni REST API
  - Health check endpoints
  - Monitoring endpoint
  - Cluster status endpoints
  - Config endpoint
  - Switchover and failover endpoints
  - Restart endpoint
  - Reload endpoint
  - Reinitialize endpoint
- patronictl
  - Configuration
  - Usage
- Replica imaging and bootstrap
  - Bootstrap
  - Building replicas
- Replication modes
  - Asynchronous mode durability
  - PostgreSQL synchronous replication
  - Synchronous mode
  - Synchronous Replication Factor
  - Maximum lag on synchronous node
  - Synchronous mode implementation
  - Quorum commit mode
- Standby cluster
- Watchdog support
  - Setting up software watchdog on Linux
- Pause/Resume mode for the cluster
  - The goal
  - The implementation
  - User guide
- DCS Failsafe Mode
  - The problem
  - Reasons for the current implementation
  - DCS Failsafe Mode
  - Low-level implementation details
  - F.A.Q.
- Using Patroni with Kubernetes
  - Use Endpoints
  - Use ConfigMaps
  - Configuration
  - Examples
- Citus support
  - TL;DR
  - patronictl
  - Citus worker switchover
  - Secondary nodes
  - Peek into DCS
  - Citus on Kubernetes
  - Citus upgrades and PostgreSQL major upgrades
- Convert a Standalone to a Patroni Cluster
  - Procedure
- Major Upgrade of PostgreSQL Version
  - FAQ
- Integration with other tools
  - Barman
- Security Considerations
  - Protecting DCS
  - Protecting the REST API
- HA multi datacenter
  - Synchronous Replication
  - Asynchronous Replication
- FAQ
  - Comparison with other HA solutions
  - DCS
  - patronictl
  - Configuration
  - Postgres management
  - Concepts and requirements
  - Automatic failover
  - Bootstrapping and standbys creation
  - Monitoring
- Release notes
  - Version 4.1.0
  - Version 4.0.7
  - Version 4.0.6
  - Version 4.0.5
  - Version 4.0.4
  - Version 4.0.3
  - Version 4.0.2
  - Version 4.0.1
  - Version 4.0.0
  - Version 3.3.2
  - Version 3.3.1
  - Version 3.3.0
  - Version 3.2.2
  - Version 3.2.1
  - Version 3.2.0
  - Version 3.1.2
  - Version 3.1.1
  - Version 3.1.0
  - Version 3.0.4
  - Version 3.0.3
  - Version 3.0.2
  - Version 3.0.1
  - Version 3.0.0
  - Version 2.1.7
  - Version 2.1.6
  - Version 2.1.5
  - Version 2.1.4
  - Version 2.1.3
  - Version 2.1.2
  - Version 2.1.1
  - Version 2.1.0
  - Version 2.0.2
  - Version 2.0.1
  - Version 2.0.0
  - Version 1.6.5
  - Version 1.6.4
  - Version 1.6.3
  - Version 1.6.2
  - Version 1.6.1
  - Version 1.6.0
  - Version 1.5.6
  - Version 1.5.5
  - Version 1.5.4
  - Version 1.5.3
  - Version 1.5.2
  - Version 1.5.1
  - Version 1.5.0
  - Version 1.4.6
  - Version 1.4.5
  - Version 1.4.4
  - Version 1.4.3
  - Version 1.4.2
  - Version 1.4.1
  - Version 1.4
  - Version 1.3.6
  - Version 1.3.5
  - Version 1.3.4
  - Version 1.3.3
  - Version 1.3.2
  - Version 1.3.1
  - Version 1.3
  - Version 1.2
  - Version 1.1
  - Version 1.0
  - Version 0.90
  - Version 0.80
- Contributing
  - Contributing guidelines
  - Patroni API docs

# Indices and tables

- Index

- Module Index

- Search Page