Linux HA – Load Balancing and High Availability

Linux HA – Heartbeat, ldirectord, apache, mysql, debian

Today, the internet is booming. Millions of people are viewing billions of pages. Some of the larger sites require robust hardware setups if the content they are serving is remotely complex, involving things like relational databases and dynamic content. We are going to look at a practical solution that is both cost effective and scalable to handle varying loads. High availability and load balancing is a technique that we can implement with apache and mysql using Heartbeat, a small, open source software package.

There are many ways this package can be set up. What we require is a number of physical servers, each behind a router. Our goals here are to have Fault Tolerance, as well as performance scalability.

Simple Linux HA – Scalable Performance

Our first configuration lacks some high availability features. It has a single point of failure, the load balancing machine Linux HA-1. Other possible points of failures are the router, and the network file storage. These two problems can be solved by looking elsewhere and are not necessarily in the scope of this article.

This is our original layout and has served quite well in many cases. It is simpler to set up and scales well as we add more machines.

The MySQL servers are set up in master-master replication mode. So a write on either of the machines will replicate to the other and vice-versa.

Diagram of Linux HA simple layout

The performance here is achieved by using the ldirectord daemon running on Linux HA-1. It acts as both the apache server and the mysql server. It keeps track of open connections on each machine, and routes the next new connection to the machine (apache or mysql) to the least loaded host (an algorithm chosen in the ldirectord configuration).

An example on how to set this up in a how-to fashion can be found at our blog http://programminglinuxgames.blogspot.com/2010/09/load-balancing-web-servers-using.html

Note this example does not use heartbeat. Heartbeat is a useful tool that will give you the fault tolerance in this set up. Below we will discuss more

Linux HA – Fault Tolerance and Scalable Performance

The next logical step in this is to remove the single point of failure, the Linux HA-1 machine. What we can do is set up heartbeat on 2 machines, and allow one to take over if the other fails at any time.

In order for one to take over for another, we will have both of these machines using a “virtual” network interface. This is just a 2nd IP address, using the virtual interface supported in linux. The circle surrounding Linux HA-1 and Linux HA-2 represents this network interface. You must assign it a separate, new IP address, and have your router route all traffic to that virtual IP address.

Highly Available and Performance Scalable set-up

More Information

http://www.linux-ha.org/wiki/Main_Page – Linux HA
http://www.ultramonkey.org/3/linux-ha.html – Ultramonkey (Heartbeat and Ldirectord)
http://en.wikipedia.org/wiki/Linux-HA – Wikipedia

162 Responses to “Linux HA – Load Balancing and High Availability”

  1. GREG says:

    aspirin pain relief dog

    Buy_drugs without prescription…

  2. KYLE says:

    symptoms of prescription drug abuse

    Buy_drugs without prescription…

  3. CHRIS says:

    rapid weight loss

    Buy_generic drugs…

  4. AUSTIN says:

    lithium alcohol

    Buy_generic drugs…

  5. KIRK says:

    embed video webpage

    Buy_generic drugs…

  6. DOUGLAS says:

    postpartum remeron

    Buy_no prescription…

  7. FRANCIS says:

    how to embed pictures ms office

    Buy_drugs without prescription…

  8. DERRICK says:

    nursing drug study website

    Buy_drugs without prescription…

  9. WADE says:

    planar warts

    Buy_drugs without prescription…

  10. HOMER says:

    dhea treatment of depression

    Buy_drugs without prescription…

  11. ANDREW says:

    avelox treats for bacteria

    Buy_drugs without prescription…

  12. BYRON says:

    what foods anorexia eat

    Buy_drugs without prescription…

  13. FREDRICK says:

    colon cancer lymph node

    Buy_without prescription…

  14. ROSS says:

    build muscle mass diet

    Buy_drugs without prescription…

  15. CLIFTON says:

    nexium pepsin ac

    Buy_generic drugs…

  16. RAMON says:

    seed implant for prostate cancer

    Buy_drugs without prescription…

  17. FRANCIS says:

    adult male wheezing new onset

    Buy_drugs without prescription…

Leave a Reply