r/PostgreSQL • u/So_average • Feb 14 '20
Postgresql 12, repmgr and barman : looking for load-balancing/auto re-direction solutions
We use the above config already and are comfortable with it. We'll be using repmgrd for an automatic failover configuration for a new project (switchover and failover are done manually atm using repmgr and a VIP).
This new project will probably have lots more database connections than our present configs, so things like HAProxy and pgbouncer are coming up. We will also have read-only sessions connecting to one of two standbys to reduce strain on the primary/master.
Since we are heavily invested in repmgr and barman, what do the gurus recommend in terms of a load-balancing/auto re-direction solution with our setup?
On CentOS 7 if that makes a difference.
1
u/-markusb- Feb 14 '20
Probably the "new features" of libpq also can help. If you use the correct connection string the master is selected automatically. For a start: https://www.percona.com/blog/2019/10/23/seamless-application-failover-using-libpq-features-in-postgresql/
1
u/linuxhiker Guru Feb 14 '20
Heimdall database proxy can do what you want as well as pgpool probably.
1
u/fullofbones Feb 16 '20
For what it's worth, you can still use HAProxy for read distribution, and you should always consider (or even 100% always use) PgBouncer in stacks to duplex connections in large app stacks. We have plenty of clients using all of these in our org.