Re: Setup load balancing using HAProxy

From: Gabriel Guillem Barceló Soteras <gbarcelo(at)parlamentib(dot)es>
To: Mahendra Singh <msmahendrasingh18(at)gmail(dot)com>, "pgsql-admin(at)lists(dot)postgresql(dot)org" <pgsql-admin(at)lists(dot)postgresql(dot)org>, "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Setup load balancing using HAProxy
Date: 2024-01-30 07:46:31
Message-ID: DU0PR08MB7921F430174316350266DE5AA67D2@DU0PR08MB7921.eurprd08.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

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(at)parlamentib(dot)es<mailto:gbarcelo(at)parlamentib(dot)es>
Àrea Tecnològica i de Gestió Patrimonial
🏛️ Parlament de les Illes Balears

From: Mahendra Singh <msmahendrasingh18(at)gmail(dot)com>
Date: Sunday, 28 January 2024 at 06:23
To: pgsql-admin(at)lists(dot)postgresql(dot)org <pgsql-admin(at)lists(dot)postgresql(dot)org>, pgsql-admin(at)postgresql(dot)org <pgsql-admin(at)postgresql(dot)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?

Regards
Mahendra Singh

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Andrey Glazunov 2024-01-31 17:08:27 Pam NIS authentication
Previous Message Laurenz Albe 2024-01-30 07:27:48 Re: pg_repack vs. running logical/physical replication