Install HAProxy in Nutanix

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:

set -ex

yum update -y
yum install -y haproxy

set -ex
echo "global
  log local0
  log local1 notice
  maxconn 4096
  user haproxy
  group haproxy

  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
  mode http
  stats uri /

frontend http
  maxconn 2000
  default_backend servers-http

backend servers-http" | tee /etc/haproxy/haproxy.cfg

hosts=$(echo "@@{App01Service.address}@@,@@{App02Service.address}@@" | tr "," "\n")

for host in $hosts
   echo "  server host-${host} ${host}:${port} weight 1 maxconn 100 check" | tee -a /etc/haproxy/haproxy.cfg

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:

Leave a Reply

Please log in using one of these methods to post your comment: Logo

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

Google photo

You are commenting using your Google 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 )

Connecting to %s

Powered by

Up ↑