Skip to main content

Load Balancing & High Availability

What is Load Balancing

What is High Availability?

What technologies can we use for this?

Keepalived

Network UPS Tools, or 'Nut', is a Open Source UPS monitoring tool, that has the ability to interface with a wide variety of different UPS & power supply brands, across several different operating system types. It is hardware and OS agnostic in nature, which makes it great to deploy on network/s that have a variety of different OS's.

Why Keepalived?

Pre-Req's

  1. Two servers

Overview

The idea here is that we will deploy NUT server on a Raspberry Pi Zero W2, with Ethernet HAT, and have that act as the NUT server, feeding the monitoring/metrics to other devices, such as virtualization hosts.

Master Server

Install the apt package needed for keepalived. sudo apt install keepalived

Get the name of the local ethernet adaptor

ifconfig Look for the entry that shows your current IP, usually eth0 or enps0 or similar.

Create the config file

Create the follow file and contents with your text editor of choice.
Example - sudo nano /etc/keepalived/keepalived.conf

vrrp_instance VI_1 {
state MASTER
interface eth0
virtual_router_id 51
priority 100
advert_int 1
authentication {
auth_type PASS
auth_pass yourpassword
}
virtual_ipaddress {
192.168.200.253/24
}
}

In this file -

  1. Replace the interface name with the one you got from the previous step.
  2. Replace the virtual ip address with the IP you want to be shared between the systems.
  3. Replace the auth_pass password with a password of your choosing.

Restart the service

Now we need to restart keepalived.
sudo service keepalived restart

Check the config works

Using the command sudo service keepalived status

Secondary Server

Install the apt package needed for keepalived. sudo apt install keepalived

Testing

Conclusion

Further Reading

HAProxy

Network UPS Tools, or 'Nut', is a Open Source UPS monitoring tool, that has the ability to interface with a wide variety of different UPS & power supply brands, across several different operating system types. It is hardware and OS agnostic in nature, which makes it great to deploy on network/s that have a variety of different OS's.

Why HAProxy?

Pre-Req's

  1. A container host

Overview

The idea here is that we will deploy NUT server on a Raspberry Pi Zero W2, with Ethernet HAT, and have that act as the NUT server, feeding the monitoring/metrics to other devices, such as virtualization hosts.

Deploy the container

Next, we need to deploy the HAProxy container. Using your container manager of choice (or GUI), deploy the following docker-compose -

note

This assumes you have used other guides on this site, with the usage of a proxynet, etc.
If you havn't, you'll need to adjust as needed.

version: '1'
services:
# haproxy-proxmox
haproxy-proxmox:
container_name: haproxy-proxmox
hostname: haproxy-proxmox
image: haproxytech/haproxy-ubuntu
restart: unless-stopped
networks:
- proxynet
volumes:
- appdata:/usr/local/etc/haproxy

# Networks
networks:
proxynet:
name: proxynet

# Volumes
volumes:
appdata:
driver: local

sudo apt install keepalived

Create the config file

ifconfig Look for the entry that shows your current IP, usually eth0 or enps0 or similar.

sudo nano /etc/keepalived/keepalived.conf

XXX

In this file -

  1. Replace the interface name with the one you got from the previous step.
  2. Replace the virtual ip address with the IP you want to be shared between the systems.
  3. Replace the auth_pass password with a password of your choosing.

Restart the container

Now we need to restart keepalived.
sudo service keepalived restart

Check the config works

Using the command sudo service keepalived status

Testing

Conclusion

Further Reading