Hi,
Brifely: HAProxy (2, TCP mode) -> PG Bouncer (2 VM) -> PGSQL farm (>=2)
Haproxy does not ‘understand’ PostgreSQL at Proxy level, it can only perform healthchecks and work at TCP level, so it does not balance queries between RO & RW nodes. Pure Haproxy-Postgresql deployment seems a bit clunky: https://www.alibabacloud.com/blog/postgresql-haproxy-proxy-for-ha-and-load-balance_597618
Still a HAP + native PostgreSQL Proxy would be strongly advised, like: https://dba.stackexchange.com/a/134925
If you don’t have a site-wide Haproxy Deployment already, I would also deploy it with 2 instances Active/Backup (i.e. keepalived). Finally, you may have to decide a replication and failover mechanism between PostgreSQL nodes that suits your needs.
Regards,
-----
Gabriel Guillem Barceló Soteras
gbarcelo@parlamentib.es
Àrea Tecnològica i de Gestió Patrimonial
🏛️ Parlament de les Illes Balears
From: Mahendra Singh <msmahendrasingh18@gmail.com>
Date: Sunday, 28 January 2024 at 06:23
To: pgsql-admin@lists.postgresql.org <pgsql-admin@lists.postgresql.org>, pgsql-admin@postgresql.org <pgsql-admin@postgresql.org>
Subject: Setup load balancing using HAProxy
Dear Experts,
Hope all is well with you.
Please share the document or link to configure load balancing in PostgreSQL 15 using HAProxy.
What is the best tool or approach to configure load balancing?