I've currently got heartbeat set up nicely on ubuntu linux server so that if the heartbeat service is not detected (either because the server is down or just the heartbeat service is down) it fallsover to the secondary server as described in a blog post on my site.

alt text

So we start at the initial state, apache on the working server dies in the interim state, then apache on the secondary server starts in the final state. Currently if apache fails but heartbeat doesn't the switch over doesn't occur. Does anyone know how to do this?


One potential solution for monitoring daemons with heartbeat 1.x that I've used successfully in production is to have a perl daemon that polls the process list at an interval and if it doesn't see the process name, it initiates the heartbeat standby. You could configure mon to duplicate this functionality.

Heartbeat 2.x has native support for this functionality and the ocf_heartbeat_apache resource agent will allow you to monitor the process.

It is also notable that heartbeat is in maintenance only mode and that Corosync is supposed to succeed it.

Where possible, I avoid the active/passive approach to high availability with Web or application servers. It wastes resources and it's often more difficult to scale horizontally. There are some situations where this is unavoidable but with Apache, this is rarely the case.

Your Web application would need to share session state, which is often accomplished by storing the sessions either in a database or in memory. At this point, you can load balance all incoming connections using a solution such as LVS or Nginx. Of course, your proxy and load balancing solution would need to be redundant to prevent a single point of failure. You could use heartbeat for this as well.

  • Thank warner, I was looking at ocf_heartbeat_apache but couldn't quite figure out how to get it working. Does it go as part of the haresources line? I'm going to set up an experimental vm to try out corosync too, thanks for pointing that out. – Gabriel Baker Aug 24 '10 at 9:35
  • The Linux HA project got updated and more fragmented, so it's totally different to configure right now. I suggest you read the Clusters from Scratch document that describes the new Pacemaker/Corosync structure. It's pretty easy to get it working. – coredump Feb 16 '11 at 1:54

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.