This guide will explain how to create a web load balancer using HAProxy, HAProxy is an open source product and who supports the purposes of fail over load balancing webserver, largely for the purpose reverse proxy in site a high daily traffic (High availability load balance (support fail over and session) using the Debian base HAProxy).

how do I see if a site (web) using a load balancer or not? easy, type on terminal your linux host -t a and enter
the result will be like this
is an alias for detik.com.
detik.com has address 202.158.66.20
detik.com has address 202.158.66.86
detik.com has address 202.158.66.94
detik.com has address 202.158.66.190
detik.com has address 203.190.241.41
detik.com has address 203.190.241.43
detik.com has the address 203 190 241 166
in this paper we use a simple diagram like this
* Load Balancer 1: lb1.example.com, IP address: 192.168.0.100
* Load Balancer 2: lb2.example.com, IP address: 192.168.0.101
* Web Server 1: http1.example.com, IP address: 192.168.0.102
* Web Server 2: http2.example.com, IP address: 192.168.0.103
* We also need a virtual IP address That floats the between LB1 and lb2: 192.168.0.99

then make sure you have to paste this line in your vhost configuration in /etc/apache2/sites-available/default
SetEnvIf REQUEST_URI "^ / check \. Txt $" dontlog
CustomLog /var/log/apache2/access.log combined env =! Dontlog

after that restart or reload your apache
/Etc/init.d/apache2 restart or /etc/init.d/apache2 reload

create a file check.txt
touch /var/www/ check.txt

2. this stage we will install its HAProxy

in lb1/lb2
for your users type in ubuntu live
sudo apt-get install haproxy

3. HAProxy configuration stage
in lb1/lb2
after you check the location of installation configuration file by typing where haproxy haproxy
in ubuntu there is usually at /etc/haproxy/haproxy.cfg, get used to the original red and swollen
cp /etc/haproxy/haproxy.cfg /etc/haproxy/haproxy.cfg_ori
cat /dev/null> /etc/haproxy/haproxy.cfg
vim /etc/haproxy/haproxy.cfg then fill with line like this
global
127.0.0.1 log local0
127.0.0.1 log local1 notice
#Log loghost local0 info
maxconn 4096
#Debug
#Quiet
user haproxy
group haproxy

The next stage is testing try a request to 192.168.0.99 then you look at loadbalancer2 by typing
ip addr sh eth0
but it's worth turning off your LB1
This at once proves if failovernya already worked together loadblancernya

loadbalancing here is to split the web server load, while for failover using keepalived

Posted by djoko oetomo on Kamis, 09 Februari 2012 - Rating: 4.5

Title : Setup Load Balancing With Fail OverDescription : This guide will explain how to create a web load balancer using HAProxy , HAProxy is an open source product and who supports the purposes o...