Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I want to setup a HA postgres database. I setup master and slave database with synchronous streaming replication on different physical servers. When there is an error in the replication, the slave db triggers a script which switches the slave db to master db.

Both servers have an additional virtual ip address configured, in normal operation this interface is down on the slave db server. In case of a failure, the script will shutdown this interface on the master db server and start the corresponding one on the slave db server. Then the script executes some arp commands to let the LAN know that the IP address mapping has changed. When db clients reconnect they connect to the slave server which runs know as master on the same ip.

This works do far, but there are scenarios where it runs into trouble.

If I pull the network plug of the master machine, the failover mechanism will trigger. The slave db becomes master db on the same IP. However the script cannot shutdown the interface with the virtual IP on the (old) master, because the network is down. If I then put the network plug back in, there will be an ip address conflict on the virtual ip.

Are there concepts to also deal with such kind of situations?

share|improve this question
add comment

1 Answer 1

I think something like heartbeat is what you are looking for. I found a HowTo for a Simple IP Failover With HeartBeat which should give you one way of solving the problem.

I believe this kind of setup is referred to as using a floating vip (as in virtual ip)

HTH

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.