I'm looking at setting up automatic failover for Apache and MySQL. I'm planning on putting a small proxy server in front of two Apache boxes, and two MySQL boxes. Apache will rsync data from the master -> slave every so often, and MySQL will be set up in Master/Slave for replication. In the event of failure the backup box(es) could take over until the master is rebuilt.

The proxy server in front will just be run as a traffic cop with some sort of heartbeat software (I'm not looking for load balancing at this point). This way I don't have to worry about changing our firewall in case the main boxes go down. Is Linux-HA the best option or are there any suggestions?


Linux HA is a nice toolset. If you want simple, go with heartbeat 1; heartbeat 2 went to more-than-2-node clusters and XML config. 1 is enough for most simple 2-node cases.

But while I agree that having a proxy in front of your application is always a good idea (running multiple servers as coming from one virtual server &c), your setup as you describe it sounds like introducing a new SPF: The proxy.

What you're probably better off doing in your case would be to run both servers in an active-active configuration, including full web service and full proxy service on both(!).

Just set heartbeat to take over three IPs: The one for the active MySQL server, the one for the active web server and the one for the active proxy (only the last one needs to be public).

Then set the proxy to always go to the internal "active web server" IP, and the web server to go to the "active DB server" IP.

When you're ready to go for a load-balancing configuration, you just have to drop the switching of the web server IP and instead put both web servers in your proxy's back-end servers group.

The initial setup could look like this:

   Server A (Apache on Port 80)   Server A (Apache Port 8080)    Server A MySQL <-----------
              |                \           |                 \        |                      \
Web <-> Public Proxy IP         >-> Shared Private Web IP     >--> Shared Private MySQL IP    | Mysql Synchronization Link
              |                /           |                 /        |                      /
   Server B (Apache on Port 80)   Server B (Apache Port 8080)    Server B MySQL <-----------

Then you can seamlessly go to real load balancing (as mentioned for web) and MySQL clustering when you're good and ready, with no user-visible changes.

Best of all: Still putting your application behind the proxy immediately (even if the proxies are 'really' just the same servers) will expose a lot of bugs in your web apps (assumptions about host names and paths in link creation &c) early!



above link help you setup Linux HA

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.