Why Patroni?

Patroni is the glue that binds all of these pieces together. It acts as a master coordinator and serves a number of roles. This is the process it uses on every Postgres server:

  1. It checks for the presence of an existing primary in the Raft layer.
  2. If no primary is found, it inserts a key in the Raft layer claiming the primary location.
  1. If this server is the primary, it signals the HAProxy layer to use it as the new redirection target.
  2. If a primary is found, it performs several checks and attempts transform the current server into a replica.

Patroni repeats these steps every few seconds on every server where it is installed. As a consequence, some outages may result in race conditions where multiple replicas will attempt to ...

Get PostgreSQL High Availability Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.