TransWikia.com

HAPROXY for Postgres Failover Master/Replica

Database Administrators Asked by Jayson Gonzaga on December 31, 2020

I have successfully set up a postgres master-replica with repmgr for automatic failover which can be found over here https://github.com/mgonzaga1990/pg-rpi-failover

Now what I’m planning to do next is to set up HAProxy However, I can’t find resources that could teach me how to properly set up load balancing together with repmgr.

My Scenario is

When master failed. One of the replicas/slave/standby servers will become the master.
Now if that happened should I always change the configuration of HAProxy do we have a way to make it automatic as well?? where HAProxy could detect who the next master is?? Then route every request to do WRITE operations on that newly elected master?

Moreover, the old master; once comes back up will not be the master but becomes slave/replica or standby.

I’m using postgres-9.6

Thanks for the response.

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP