Re: Request for Feedback on PostgreSQL HA + Load Balancing Architecture - Mailing list pgsql-general

From Greg Sabino Mullane
Subject Re: Request for Feedback on PostgreSQL HA + Load Balancing Architecture
Date
Msg-id CAKAnmmLxh5bzdi_f7FJX+fq7YqEGMZ9+FVKBi0uKG44ssTEgLQ@mail.gmail.com
Whole thread Raw
List pgsql-general
Is this architecture considered a best practice within the PostgreSQL community?

I would say Patroni is probably "best practice", but there are other people out there happy with, and expert with, repmgr as well.

Are there any potential bottlenecks or failure points I should be aware of?

How is pgbouncer supposed to know which db to go to?I would think since HAProxy has some way to tell, that pgbouncer should go on other side of haproxy (between the app and haproxy)

Would you recommend any improvements or alternative tools for achieving better reliability and performance?

Seems you need a witness server or some sort. Your HA system should have a few main goals:

* Immediately fail over to a replica should the primary go down
* Reroute the application traffic
* Rebuild the old primary as a replica
* Never, ever allow there to be more than one primary server

Secondary goals:
* make the non-Postgres things redundant (as with keepalived and haproxy)
* provide read/write traffic routing (as you kind of have here)
* some sort of backup system (don't see any here)

Your design will also depend on how bulletproof you want your HA system to be, and how much data your application is allowed to lose.

Cheers,
Greg

--
Enterprise Postgres Software Products & Tech Support

pgsql-general by date:

Previous
From: Laurenz Albe
Date:
Subject: Re: Postgresql 16.9 fast shutdown hangs with walsenders eating 100% CPU
Next
From: "Peter J. Holzer"
Date:
Subject: Wrapping a select in another select makes it slower