Load Balancer for AWS and Azure on Linux
A Load Balancer lets you distribute traffic to your backend virtual machines. A Load Balancer is a fully managed service that provides high availability for your applications. With Standard Load Balancer, you can scale your applications and create highly available services. Load Balancer supports both inbound scenarios and outbound scenarios. A Load Balancer provides low latency and high throughput and scales up to millions of flows for all TCP applications as well as UDP applications.
Sample configuration
group azure-lb-grp (
SystemList = { ip-10-10-10-8 = 0, ip-10-10-10-9 = 1 }
)
NIC nicres (
Device = eth0
)
IP ipres (
Device = eth0
Address = "10.10.10.10"
NetMask = "255.255.255.0"
)
Process port_app (
PathName = "/port_probe.sh"
Arguments = "port_app 5000"
PidFile = "/var/VRTSvcs/lock/volatile/port_app_pid"
)
ipres requires nicres
ipres requires port_app
The contents of the
port_probe.sh file are as follows:
cat /port_probe.sh
\#!/bin/bash
res=$1
port=$2
pid_file="/var/VRTSvcs/lock/volatile/${res}_pid"
NC="/usr/bin/nc"
old_pid=`ps -eo pid,args | grep -w "nc" | grep -w $port$
| awk '{ print $1 }`
if [ -n $old_pid ]; then
kill -9 $old_pid
fi
$NC -l -k $port &
pid=$!
echo $pid > $pid_file
exit 0
Related information