HAPROXY

HAProxy(High Availability Proxy) is an open source load balancer which can load balance any TCP service. It is particularly suited for HTTP load balancing as it supports session persistence and layer 7 processing.

>> Haproxy does loadbalancing between the http apache webserver.That is when a client sent a request to the webserver , the request goes to the loadbalacer
and then the loadbalancer ie Haproxy distribute the request among the webserver present in the loadbalancer.

Load Balancing between two apache web servers using the HAproxy.

Our webserver is
1> web01  (192.168.153.128)
2> web02  (192.168.153.129)

Loabalancer ( 192.168.153.130)

And a loadbalancing server is load01

Let install haproxy on loadbalancer machine

http://www.leaseweblabs.com/2011/07/high-availability-load-balancing-using-haproxy-on-ubuntu-part-1/

1.First I have install haproxy on server load01 ( 192.168.153.130 )

loadb01$ sudo apt-get install haproxy

2.Now take the backup of the haproxy original file

loadb01$ sudo mv /etc/haproxy/haproxy.cfg /etc/haproxy/backup_haproxy.cfg
loadb01$ sudo vi /etc/haproxy/haproxy.cfg

global
maxconn 4096
user haproxy
group haproxy
daemon

defaults
log     global
mode    http
option  httplog
option  dontlognull
retries 3
option  redispatch
maxconn 2000
contimeout      5000
clitimeout      50000
srvtimeout      50000

listen webcluster *:80
mode    http
stats   enable
stats   auth us3r:passw0rd
balance roundrobin
option httpchk HEAD / HTTP/1.0
option forwardfor
cookie LSW_WEB insert
option httpclose
server web01 192.168.153.128:80 cookie LSW_WEB01 check
server web02 192.168.153.129:80 cookie LSW_WEB02 check

3.We needto enable the haproxy for that we need to enable it in /etc/default/haproxy

# Set ENABLED to 1 if you want the init script to start haproxy.
ENABLED=1
# Add extra flags here.
#EXTRAOPTS=”-de -m 16″

4.Now let start haproxy

/etc/init.d/haproxy start

 

 

 

Good contents== http://support.severalnines.com/entries/23612682-Install-HAProxy-and-Keepalived-Virtual-IP-

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s