// What runs on ZooKeeper / patroni

Does Patroni (PostgreSQL HA) use ZooKeeper?

One of several DCS options

Patroni keeps PostgreSQL cluster state and the leader lock in a distributed configuration store (DCS). ZooKeeper is one supported DCS, alongside etcd, Consul, Kubernetes and Exhibitor. Patroni's own built-in Raft option has been deprecated since Patroni 3.0. With ZooKeeper as the DCS, the leader lock is an ephemeral znode, so the health of the ensemble decides whether PostgreSQL keeps a writable primary.

Trusted globally by enterprises

Henry ScheinEnbridgeGojekMicrosoft

What Patroni (PostgreSQL HA) uses ZooKeeper for

  • The leader lock: an ephemeral znode at /service/<scope>/leader. The node that holds it runs the PostgreSQL primary. If its ZooKeeper session expires, the znode disappears and a replica can take it.
  • Member registration: each node keeps an ephemeral znode under members/ with its connection details, role and replication position.
  • Cluster-wide state: the dynamic configuration (config), the initialize key, switchover and failover requests, synchronous standby state (sync), timeline history and the failsafe member list.
  • patronictl reads and changes the cluster through the same keys, for example with patronictl edit-config.

Which ZooKeeper version ships with Patroni (PostgreSQL HA)

Patroni is written in Python and talks to ZooKeeper through the kazoo client library (kazoo>=1.3.1 in requirements.txt; TLS needs kazoo 2.6.0 or later). It does not bundle a ZooKeeper server or a Java client, so the ZooKeeper version that matters is the one the ensemble runs. Patroni does not document a minimum ZooKeeper server version. kazoo 2.11.0, the current release, tests against ZooKeeper 3.6.4, 3.7.2, 3.8.3 and 3.9.1.

CVE counts are ZooKeeper's own advisories matched against the upstream version. The Apache ZooKeeper project does not assess end-of-life lines against new advisories, so "not assessed" means unknown, not safe.

Which DCS is Patroni using?

patronictl -c /etc/patroni/patroni.yml list
grep -E '^(zookeeper|exhibitor|etcd3?|consul|kubernetes|raft):' /etc/patroni/patroni.yml

# What Patroni keeps in ZooKeeper (default namespace /service)
bin/zkCli.sh -server zk1.internal:2181 ls /service

# Version of the ensemble
echo srvr | nc zk1.internal 2181 | head -1

Can Patroni (PostgreSQL HA) run without ZooKeeper?

Yes. etcd (v3 API), Consul and Kubernetes are all supported DCS backends, and a single DCS cluster can hold many Patroni clusters under different scopes. Moving off ZooKeeper changes where the leader lock lives, so it is planned as cluster maintenance rather than a configuration edit.

Patroni 4.1.5, released on 12 August 2026, is the latest release. 4.0.11 shipped the same day, and 3.3.11 in July 2026.

Your options

Move the DCS

Switching Patroni from ZooKeeper to etcd is a controlled cluster maintenance operation rather than a database migration.

Enable failsafe mode first

Before any work on the ensemble, failsafe_mode (Patroni 3.0 and later) lets the primary keep running through a DCS outage, as long as it can reach every replica through the Patroni REST API.

Keep the shared ensemble patched

When the ZooKeeper ensemble also serves other systems, OSSeva patches it in place, including the 3.4 to 3.7 lines, so Patroni sees no change in API or data format.

Most teams buy this at the product level: keep the Patroni (PostgreSQL HA) estate supported, including the ZooKeeper under it. See Patroni support.

Frequently asked questions

Is Patroni's built-in Raft still supported?

It was deprecated in Patroni 3.0.0 (January 2023) and is still documented but not recommended. Use etcd, Consul, ZooKeeper or Kubernetes.

What happens to PostgreSQL if ZooKeeper goes down?

Patroni lets a node run PostgreSQL as primary only while it can update the leader lock. If the update fails, Patroni demotes PostgreSQL to read-only. With failsafe_mode enabled, the primary can keep running if every known member confirms it through the REST API.

Which ZooKeeper versions does Patroni support?

Patroni does not publish a minimum server version. It uses the kazoo Python client, and TLS needs kazoo 2.6.0 or later. kazoo 2.11.0 tests against ZooKeeper 3.6.4, 3.7.2, 3.8.3 and 3.9.1.

How does Patroni's ttl relate to ZooKeeper?

Patroni passes ttl to kazoo as the session timeout, so the leader znode disappears when that session expires. ZooKeeper negotiates the timeout within minSessionTimeout and maxSessionTimeout, which default to 2 and 20 times tickTime.

Keep Patroni (PostgreSQL HA) and the ZooKeeper under it supported.

Send us your versions; we reply with coverage, exposure and a plan within five working days.