Apache load balancing and failover

October 5, 2012 in Web Server

The second web server in this example will take the internal ip 192.168.0.251 and you must create it with a replica of your website.

The Pound server in this example will take the internal ip 192.168.0.252. Now you have to configure your router to redirect all the requests for port 80 to Pound server (in this example to 192.168.0.252).

Note Pound server has no webservice installed. This server will just redirect the requests to the web servers!!! Ok so now you have a network topology like the following.

Lets install pound to our load balancing server. To do so open a terminal and type:

sudo apt-get update

sudo apt-get install pound

Now you have installed Pound in the loadbalancing server but you have to configure it in order to activate it. Open a terminal and type:

sudo gedit /etc/pound/pound.cfg

or in Ubuntu server edition

sudo nano /etc/pound/pound.cfg

Now go down to "ListenHTTP" and in Address use the Pound ip in this eaxample 192.168.0.252 and use the port 80

Now after the word "Service" add a new line and write "HeadRequire "Host:.*www.allaboutlinux.eu.*"" where allaboutlinux.eu is your domain name.

At the backend address write the internal ip of your 1st web server in this example 192.168.0.250 and set port to 80.

Now create a new backend for your second webserver with address 192.168.0.251 and port 80.

Your file now should look like the following picture

Now we are almost ready! Save and close the cfg file open a terminal and type:

sudo gedit /etc/default/pound

and change the startup=0 to startup=1. After that save and close. Now type

sudo /etc/init.d/pound start

this command will start the load balancing server



Pages: 1 2