HAPROXY, The easy load balancer

Load balancing the easy way, with haproxy. I use this all the time with docker. This example will balance 53, across 6 DNS backends. To tweak for your use, you can change the stats port, username and password, and backend servers to your setup.

port 1936 will show the cluster health page. port 53 will round-robin balance across the 6 hosts, and will also pull them out if not healthy, adding them back once health checks pass!

        log   local0
        log   local1 notice
        maxconn 4096
        chroot /var/lib/haproxy
        user haproxy
        group haproxy
        log     global
        mode    http
        option  httplog
        option  dontlognull
        option redispatch
        retries 3
        maxconn 2000
        contimeout      5000
        clitimeout      50000
        srvtimeout      50000

listen stats :1936
        mode http
        stats enable
        stats auth username:password

listen myservice :53
        mode tcp
        option tcplog
        balance roundrobin

        server dns0 check
        server dns1 check
        server dns2 check
        server dns3 check
        server dns4 check
        server dns5 check
comments powered by Disqus