Tuesday, March 9, 2010

Load-Balacing with Apache webserver

Hi friends,

I have created load-balancing in ubuntu (9.04) for apache server using Crossroad (XR).
You can download Crossroad from http://crossroads.e-tunity.com/downloads.xr. I have configured CrossRoad on 10.6.26.48. You need C compiler (GCC) or C++ Compiler (G++) to compile crossroad, and follow below steps:

1. sudo apt-get install build-essential
2. cd /usr/local/src/
3. sudo tar xvzf ~/Desktop/crossroads-stable.tar.gz
4. cd crossroads-1.59
5. sudo make install
Check that the application was installed where it was supposed to be.

6. cd /usr/local/bin
Create a file called crossroads.conf by using the command below.
7. sudo touch /etc/crossroads.conf
8. sudo vi /etc/crossroads.conf
and copy and paste below code:

service www {
port 80;
revivinginterval 15;
type http;
dispatchmode random;
backend one {
server 10.6.26.12:80;
}
backend two {
server 10.6.26.5:80;
}
}

Here I have creted two backend web-servers (10.6.26.12, 10.6.26.5).We have to install apache webserver on both machine, no need to install apache server on 10.6.26.48. You have to change the ip address according to your use.

Once you have written your configuration file, you can start the server
crossroads start

Surf to the IP address (on eth0 in my case) which the user will be using. Your real servers should now receive connections through the load balancing server and respond to the user through it as well.

Test:
give the ip address of 10.6.26.48 on any browser on the network, and you can see the forwarded request.

No comments:

Post a Comment