Patroni: Use HAProxy and/or provide a load balancer recipe to bypass PgBouncer
Summary
https://docs.gitlab.com/ee/administration/postgresql/replication_and_failover.html#backups
Do not backup or restore GitLab through a PgBouncer connection: this causes a GitLab outage.
also
https://docs.gitlab.com/omnibus/update/#use-postgresql-ha
If you’re using PgBouncer:
You’ll need to bypass PgBouncer and connect directly to the database master before running migrations.
Proposal
Patroni supplies a suggest HAProxy config, and it allows a load balancer to determine from Patroni where the leader PostgreSQL instance is.
This presents a way to create a load balanced VIP that will always point to a valid database for backups, restores, and upgrades. Much nicer than hard coding it on the backup node / upgrade node, and it breaking in the event that a failover occurs.