Load Balancing/FailOver System For 2 Servers on Different Datacenters

  • Posted on August 19, 2014
  • appsfactAsked by appsfact

I am using Ubuntu 12.04 and I need to implement simple/effective Load Balancer / Fail Over System as per the below requirements:

a. It should balance the load between two different public IPs (two different servers on different VPS hosting companies). I need to balance my web application (PHP, MySQL) and also my email server (Postfix, Dovecot, Spamassasin, clamAV, amavis)

b. I don’t want to use more than two servers. The project (web application+ email server) are deployed on two servers and I have only two IP addresses (IPv4).

c. I don’t want single point of failure, i.e., the load balancer/failover must work on both servers, so in case one machine is down, the second will take over.

I have seen many tutorials on how to make the balancer on servers on same subnet, but I need to make it between two servers on different datacenters.

Would you please advise if this can be done? I would greatly appreciate if you provide me with a simple tutorial or hints to do it. I am still beginner to this technology.


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Looking at your requirements, it sounds like a third-party solution will be your best bet. Look into using something like CloudFlare. That will allow you to eliminate the hardware load balancer as a single point of failure. Since these seem not to be stactic sites, you’ll also need to set up the servers to replicate the database between them.