Creating a HA, HAProxy cluster with NGINX Backend - blake-anderson/SEC-440 GitHub Wiki

Creating the HAProxy Server (Ubuntu 16)

Installing

apt update

apt install -y haproxy

To enable on startup,

systemctl enable haproxy

Configuration

HAProxy operates almost exclusively off a single configuration file, here is the one I used.

nano /etc/haproxy/haproxy.cfg

The config file is in the code repository in this github page. Copy / paste it with the correct IP’s https://github.com/blake-anderson/SEC-440/blob/master/haproxy.cfg%20-%20Week%202

Lastly, finish off with

systemctl restart haproxy

This is all that needs to be done for HAProxy, navigate to http ://IPADDRESSHERE/stats:8404 to see a cool stats page.

Setting Up Keepalived for HA, HAProxy

Install keepalived

apt get install keepalived

This also runs off of a very specific config file, much like HAProxy

nano /etc/keepalived/keepalived.conf

The config file is in the code repository in this github page. Copy / paste it with the correct IP’s https://github.com/blake-anderson/SEC-440/blob/master/keepalived.config%20-%20Week%202

Note on the configuration- The only line that needs to be changed is the priority line, which MUST have different values for each node (Higher = Master).

systemctl restart keepalived

To figure out master status,

systemctl status keepalived will list out the most recent events.

⚠️ **GitHub.com Fallback** ⚠️