Take the 2-minute tour ×

I'm using a hot standby server for my postgres database. I've assigned a virtual ip address to the server. In case of a failure I'm switching the virtual ip from the master to the hot standby server. The problem is, that clients accessing the db, still have the old route to the master server in their ARP cache. The hot standby server is not reachable direcly. Is their a way to force the clients to clear their ARP cache?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

Not every host / IP implementation would cache data from a gratuitous ARP (which you could send using arping).

You should be using a daemon which is not just using a virtual IP but also a virtual MAC address for this purpose. Heartbeat / UCARP / VGP are names of software projects that implement this kind of functionality.

share|improve this answer
I’m monitoring the postgres db servers with nagios. If nagios detects a problem with postgres it’s calling the a shell script which switches ip addresses and makes the hot standby server tot he master server. I just added „arping -c 1 -S „ to the script. If I do a permanent ping to the virtual ip from another machine in the net work, ping is responding continuous now when do the switch. Before it took up to 60+ seconds before ping was answering again. In my test environment it seems to work now. Do I need to care about anything else? –  markus Oct 21 '11 at 16:16
If all of your database server's communication partners are under your control, then you at least can ensure that a gratuitous ARP is honored for an ARP cache update on all hosts. As I mentioned, hosts, especially routers, may have this disabled, typically due to security reasons. –  the-wabbit Oct 21 '11 at 18:17

If the list of IPs for the clients is tractable, you can have the new server ping them all once it has plumbed the virtual IP address. Each client's IP code should update its ARP table upon seeing the IP coming from a new MAC address.

You might be able to ping to a broadcast address -- I've never tried that in any context, let alone trying to tickle other system's to update ARP. But, that would eliminate the stand-by system even needing to know who to ping. You could also just have the stand-by system ping every address in it's local network once it's plumbed the virtual IP.

share|improve this answer

Your Answer


