Nutanix HAProxy

To install the HAProxy Load Balancer through the script in Nutanix CALM is available here to load balance the Apps traffic though HAProxy software in Linux virtual machine ( VM ).

Nutanix HAProxy Load Balancing Script is here:

HAProxy Load Balancer Installation

Use the following HAProxy script to install Load Balancer service in Linux VM.

HAproxy Load Balancer Script for Linux OS:

#!/bin/bash
set -ex
yum update -y
yum install -y haproxy
#!/bin/bash
set -ex
echo "global
  log 127.0.0.1 local0
  log 127.0.0.1 local1 notice
  maxconn 4096
  quiet
  user haproxy
  group haproxy
defaults
  log     global
  mode    http
  retries 3
  timeout client 50s
  timeout connect 5s
  timeout server 50s
  option dontlognull
  option httplog
  option redispatch
  balance  roundrobin
# Set up application listeners here.
listen admin
  bind 127.0.0.1:22002
  mode http
  stats uri /

frontend http
  maxconn 2000
  bind 0.0.0.0:80
  default_backend servers-http

backend servers-http" | tee /etc/haproxy/haproxy.cfg
hosts=$(echo "@@{App01Service.address}@@,@@{App02Service.address}@@" | tr "," "\n")
port=80
for host in $hosts
do
   echo "  server host-${host} ${host}:${port} weight 1 maxconn 100 check" | tee -a /etc/haproxy/haproxy.cfg
done
systemctl daemon-reload
systemctl restart haproxy
firewall-cmd --add-service=http --zone=public --permanent
firewall-cmd --reload

Thanks to being with HyperHCI Tech Blog to stay tuned for latest techie updates.!

Useful Links: