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:
- It checks for the presence of an existing primary in the Raft layer.
- If no primary is found, it inserts a key in the Raft layer claiming the primary location.
- If this server is the primary, it signals the HAProxy layer to use it as the new redirection target.
- 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 ...