I have 2 servers running postgresql database as Master-slave. Application connects to master normally and when the switchover occurs, we need to change IP in application to connect to slave. In one of our use cases, we require that in switchover the IP of slave should be changed to the IP of master node. Is there anything which can help me in this case?
Asked
Active
Viewed 25 times
1 Answers
1
You typically use a virtual IP address for that; the details depend on your operating system.
PostgreSQL always listens on the virtual IP address, and on failover you move the address to the other machine.
Laurenz Albe
- 129,316
- 15
- 96
- 132
-
You are right. But due to some reason we cannot use Virtual IPs so changing the slave IP to master somehow is required by application – makhshif afiniti Apr 23 '20 at 21:05
-
Then the "some reason" is bad. – Laurenz Albe Apr 24 '20 at 06:28