Обсуждение: HAProxy + Patroni + pgBouncer High Availability setup

Поиск
Список
Период
Сортировка

HAProxy + Patroni + pgBouncer High Availability setup

От
Jānis Pūris
Дата:
Hello,

I have a working HAProxy, Patroni, PG stack and would like to add pgbouncer in the mix.

Current topology descr.
Haproxy is checking Patroni API, if the node it is responsible for is primary, if so, the requests are routed to it's postgresql server. When a failure occurs Patroni would do its magic and a different node in the cluster is promoted, HAProxy sees it via Patroni API checks and requests are rerouted to this new node. It works!

The problem
if I'd deploy pgBouncer between HAProxy and PostgreSQL, it would be a single point of failure. For example, if pgBouncer fails on primary, Patroni would not mind and no other node would take primary to mitigate the disaster.

Topology
[client] <--> [haproxy] <---> [pgbouncer] <---> [postgres]
        |-----------> [patroni] <-------->/

How can I improve the architecture, to avoid single point of failure ? I could of course add watchdog and similar processes, but I would really prefer not too overcomplicate the stack.

P.S. Deploying pgBouncer before client app is not an option, as a lot of different API and clients are talking to the cluster, as well as they are deployed in range of environments, i.e. kubernetes, metal, vms etc and so on.

Best regards, JP.