Subscribe Us

Load Balancing & Failover using HAProxy for RHEL | Cent Os | Ubuntu | Debian

HAProxy is open source proxy that can be used to enable high availability and load balancing for web applications. it was designed especially for high load projects so it is very fast and predictable, HAProxy is based on single-process model.

The following diagram summarizes the architecture:


This Package available on epel repository :

1.Install HAproxy and enable it's service on boot:
#yum install haproxy -y
#chkconfig haproxy on

If you’re Ubuntu, Debian or Linux Mint user use this one instead:
#apt-get install haproxy

2.It's time to edit our configuration file:

# vim /etc/haproxy/haproxy.cfg 
global
        user daemon
        group daemon
        daemon
        log 127.0.0.1 daemon
 
listen http
        bind 1.2.3.4:80 # this is public external external. 
        mode http
        option tcplog
 
        log global
        option dontlognull
 
        balance roundrobin
        clitimeout 60000
        srvtimeout 60000
        contimeout 5000
        retries 3
        server web1 web1.example.com:80 check # webserver-1
        server web2 web2.example.com:80 check # webserver-2
        cookie web1 insert nocache
        cookie web2 insert nocache

3.Save the file and restart HAproxy:

#/etc/init.d/haproxy restart

4. Check that HAproxy, which is listen public ip on port 80 via:

#lsof -i :80
 haproxy 32607 haproxy 4u IPv4 134165 0t0 TCP server01:http (LISTEN)

Test on your web browser http://1.2.3.4:80 & refresh more time;




Post a Comment

5 Comments

  1. Awesome blog! Is your theme custom made or did you download it from somewhere?

    A design like yours with a few simple tweeks would really make my blog jump out.
    Please let me know where you got your theme. Bless you

    Also visit my weblog canlı bahis siteleri

    ReplyDelete
  2. This is my first time go to see at here and i
    am genuinely happy to read everthing at single place.


    My page dragon city hack tool

    ReplyDelete
  3. It's difficult to find well-informed people on this topic, however, you sound like you know what you're talking about!
    Thanks

    my site Beats By Dre Studio

    ReplyDelete
  4. What's up, the whole thing is going fine here and ofcourse every one is sharing information, that's in fact fine,
    keep up writing.

    Here is my blog - Christian Louboutin Online

    ReplyDelete
  5. Attractive section of content. I just stumbled upon your weblog and in accession capital to
    assert that I get actually enjoyed account your blog posts.
    Any way I'll be subscribing to your augment and even I achievement you
    access consistently quickly.

    Also visit my homepage: Kitty Flats

    ReplyDelete