How To Set Up A Loadbalanced High-Availability Apache Cluster - Page 4

Want to support HowtoForge? Become a subscriber!
 
Submitted by falko (Contact Author) (Forums) on Thu, 2006-04-27 11:04. ::

7 Further Testing

You can now access the web site that is hosted by the two Apache nodes by typing http://192.168.0.105 in your browser.

Now stop the Apache on either webserver1 or webserver2. You should then still see the web site on http://192.168.0.105 because the load balancer directs requests to the working Apache node. Of course, if you stop both Apaches, then your request will fail.

Now let's assume that loadb1 is our active load balancer, and loadb2 is the hot-standby. Now stop heartbeat on loadb1:

loadb1:

/etc/init.d/heartbeat stop

Wait a few seconds, and then try http://192.168.0.105 again in your browser. You should still see your web site because loadb2 has taken the active role now.

Now start heartbeat again on loadb1:

loadb1:

/etc/init.d/heartbeat start

loadb2 should still have the active role. Do the tests from chapter 5 again on loadb1 and loadb2, and you should see the inverse results as before.

If you have also passed these tests, then your loadbalanced Apache cluster is working as expected. Have fun!


8 Further Reading

This tutorial shows how to loadbalance two Apache nodes. It does not show how to keep the files in the Apache document root in sync or how to create a storage solution like an NFS server that both Apache nodes can use, nor does it provide a solution how to manage your MySQL database(s). You can find solutions for these issues here:


9 Links


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.
Submitted by faizan (not registered) on Thu, 2009-11-12 07:20.
hey guys i have done almost complete work and all tests went fine but the only problem which i am facing is in ldirectord.cf file ..........................my request is not forwarding toward the real server......................

if anybody knows about the problem plz help me .........

Submitted by Anonymous Coward (not registered) on Tue, 2008-11-25 12:33.

Nice article, although I think Load Balancing is a little misleading.

This is High Availability - an active / passive server relationship, there is no load sharing

Submitted by John Langley (not registered) on Tue, 2011-01-25 17:16.

I know this is an old article, but it seems still valid, I hope to try it out soon with some VM's before I try this on our production site! 

That said, I saw the comment I'm replying to, and, at first glance, it seemed right and I got frustrated that I would have to continue my search on how to do HA & LB w/Apache.  But, the only portion of this solution that isn't load balanced are the balancers themselves.

As to Apache being load balanced, you can see that it is based on page 3 of the article from the output of ipvsadm -L -n.   You can see how the load balancer master is listening on the 105 virtual IP and knows about two Apache servers at 101 & 102.  Since the weights are "0" requests will be handed off 50/50 for each server (rather, new sessions will be split 50/50).  I don't know any of the commands personally yet but you'd want to change the weight based on the hardware capabilities of the servers as well as if either the 101 or 102 box had other tasks they were solely responsible for.

Also if you wanted to get real inventive I think you could set your session directory to be on a SAN, so that if the 101 or 102 box went down, the sessions wouldn't be blown away ... something I hope to test!

Submitted by namwodahs (registered user) on Thu, 2006-10-19 22:06.
This is a great tutorial! Worked first time through. I've been very impressed with your selection of tutorials on this site. Thank You!
Submitted by Anonymous (not registered) on Mon, 2006-05-15 12:06.

How To very mutch!!!!

By Marcos Abadi

Brazilian

Submitted by Anonymous (not registered) on Sun, 2008-09-28 20:43.

Hi,

seems to be a great tutorial !

I'd like to know if this kind of load balancing setup can be SSL aware, means, an SSL session is able load balanced between nodes ?

Thanks a lot 

Submitted by Ashish (not registered) on Mon, 2011-10-31 10:44.

Hello,

 You can use pound as load balancers, it supports SSL feature...

 

Cheers,

Ashish Jaiswal

Submitted by Anonymous (not registered) on Tue, 2008-09-30 23:03.
can you tell me if this tutorial implements session-aware load-balancing as we need to use this for big site which is session driven.