Assigning virtual IP in repmgr

1.3k Views Asked by At

I have a postgres cluster made using repmgr. This is the requirement of the application that they should not have to change the IP in the application when the database switchover occurs. Is there a way to use virtual IP with repmgr which outside clients can use and database switchover should not demand changing IP in application

1

There are 1 best solutions below

0
On

You can use HAproxy, target your primary DB, use with healthcheck and in case of not responding for some time HAproxy will redirect to your standby DB for example.

But if you don't want to introduce a SPOF with a loadbalancer and just want a simple two node cluster, then you could use HA2node.

https://github.com/jfekete1/HA2node

Keep in mind that HA2node only works on Linux servers with postgres and repmgr installed.