What is the best way to setup a heartbeat agent for failover between two VMs? [closed]

I have two VMs in VirtualBox that use NAT for their network adapters. They are both getting the same IP address, so I will need to reconfigure that; but knowing that, is it possible to set up a heartbeat agent to failover an apache server if one of the two VMs go down?

The way I pictured it would be that the webserver would be able to be accessed externally via :80. No matter what VM was running, I would be able to access the website at that IP/port since failover would be setup.

I’m running into trouble setting up IPs when the network adapters are set to NAT, and people have told me that I shouldn’t be setting the IPs in this configuration. So what should I do to achieve what I’m looking for? Is it even feasible?

Answer

The most common approach is sticking the web servers behind a load balancer and leaving the services running on both. You setup both Active/Passive and Active/Active depending on your requirements.

If you can’t afford, or don’t want to buy physical load balancers, then you can achieve what you are requesting by:

  • setting up something like piranha, assuming you are running linux. It is possible to use the same machines as those running web server for this.

  • or you can cluster them with RHCS, again, assuming you are running linux.

The possibilities are endless.

Attribution
Source : Link , Question Author : EGr , Answer Author : Petter H

Leave a Comment