Score:0

Patroni Haproxy and pg-bouncer architecture

mq flag

I'm building a patroni postgres cluster, however, I can't decide which is better architecture

App > HAproxy > Pgbouncer > PostgreSQL (patroni)

App > PGBouncer > HAproxy > PostgreSQL (patroni)

I can't seem to get an answer upon my search and a lot of conflicted answers. Some say its better to have haproxy in front and others say the opposite .

I would appreciate your opinion on this matter

Score:0
in flag

First option is what you want, because pgBouncer is a connection pooler for PostgreSQL. It needs to be close to DBMS and be one2one connected each one to its own Postgresql instance. As for HAProxy it is a load balancer, you can have HAProxies' number different than a number of Postgre\Patroni\pgBouncer instances. Plus it will give you an option to separate read and write requests to different ports\databases.

here is an article which will be helpful https://medium.com/@nicola.vitaly/setting-up-high-availability-postgresql-cluster-using-patroni-pgbouncer-docker-consul-and-95c70445b1b1

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.