Installing Load Balancer

To install the HAProxy Load Balancer, Cloudera uses an example that uses a single instance of HAProxy, configured with round robin balancing and TCP mode. This allows for non-terminating https (https passthrough). The HAProxy service can be configured for High Availability using keepalived.

You must consult your operating system vendor’s documentation for requirements and the install guide for configuring HAproxy with keepalived.

To install a HAProxy Load Balancer, you must ssh into the HAProxy host, install, and then configure HAProxy:

  1. sudo su -
  2. yum install haproxy -y
  3. cp /etc/haproxy/haproxy.cfg /etc/haproxy/haproxy.cfg.bak
  4. cat > /etc/haproxy/haproxy.cfg << EOF
    log local2
    chroot /var/lib/haproxy
    pidfile /var/run/
    user haproxy
    group haproxy
    mode tcp
    log global
    option tcplog
    option dontlognull
    option redispatch
    retries 3
    maxconn 5000
    timeout connect 5s
    timeout client 50s
    timeout server 50s
    listen stats
    bind *:8081
    mode http
    stats enable
    stats refresh 30s
    stats uri /stats
    monitor-uri /healthz
    frontend fe_k8s_80
    bind *:80
    default_backend be_k8s_80
    backend be_k8s_80
    balance roundrobin
    mode tcp
    server check
    server check
    server check
    frontend fe_k8s_443
    bind *:443
    default_backend be_k8s_443
    backend be_k8s_443
    balance roundrobin
    mode tcp
    server check
    server check
    server check
    systemctl enable haproxy
    systemctl restart haproxy
    systemctl status haproxy
  5. You can verify that all the hosts are shown from the HAproxy UI. However, at this point the hosts are not listening to the configured ports.
Load Balancer is now installed.