I have two Linux servers (CentOS6) - both are identically configured connected to the same switch with a direct link between them. I only have one external IP that is assigned to eth0 on both servers (connected to the internet switch) with the interface shutdown on server 2.

How can I failover to server 2 if server 1 dies - as stated they are linked directly so they can check for availability of each other via ping/tcp/udp. I toyed with Heartbeat but the documentation seems to be non-existent - not sure how to bring up an interface and start some services if the other server dies.


I would use Heartbeat. The problem with the docs is that Heartbeat is now a component of Pacemaker:


Heartbeat is sufficient to failover an IP address, but will not detect service failures (e.g., your httpd process dies). You don't have to set up the full Pacemaker configuration if you only care about IP addresses; in that case, you can use the version 1 (Heartbeat) configuration that uses /etc/ha.d/haresources as the resource list.

| improve this answer | |
  • I have Monit watching individual services so hopefully that takes care of that. I will look at that documentation and see if I can make it work. – Lukasz Apr 2 '12 at 16:09

It is also possible to use Keepalived which is a VRRP implementation that sends multicast checks between the servers and if a timeout is reached it will fail over to the other server.

The configuration is pretty straight-forward and it can check for services and be used as load balancer.

Improving Network Reliability with Keepalived from linux devcenter provides some more information about the VRRP part of Keepalived.

Failover and loadbalancer using keepalived (LVS) on two machines describes more of the loadbalancer part of Keepalived and is very good for understanding a bit more of the components and usage cases.

Last but not least the manual provides some information about how to run it.

The best way to get to know Keepalived is to read the documentation on the project site.

| improve this answer | |

Your Answer

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

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