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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.