Lab 14‐1 ‐ HAProxy Load Balancer - Isaiah-River/NET-330-01-Network-Design GitHub Wiki
To start this lab, I downloaded two base VMs. I then copied the CentOS-apache-base VM so that I would be able to have two VMs. I then opened each of these within VMware Workstation, and powered them on. I renaming the copies to VMs to Server 1 and Server 2. On each of these I ran the dhclient
command to get an IP address. I then ran ip addr
to show my IP address, and ensured that the two servers had connectivity.
Once confirming I could ping across these VMs I created an index file with my name and server number within /var/www/html, and started each of their apache servers by running the systemctl start httpd
command, and ensured that my workstation could navigate to these addresses:
I then booted up the HA Proxy VM and logged in, and ran the dhclient
command to pull an IP address. I then pinged the web servers to ensure I was able to reach them.
I then ran the following commands:
vi /etc/haproxy/haproxy.cfg
I then navigated to the HA proxy address, where I was directed to a Server1, and refreshing brought me to Server2
vi /etc/rsyslog.conf
systemctl restart rsyslog
I then ran the command tail -f /var/log/haproxy.log
to pull the logs, which showed nothing, I then refreshed my connection to the front end a couple of times, and reran the command:
vi etc.haproxy/haproxy.cfg
Add check after servers:
systemctl restart haproxy
tail -f /var/log/haproxy.log
I then shutdown server 2 and waited for the response
I then booted it up and ran dhclient
and systemctl start httpd
again. This was logged with the server coming back up:
On server 1 and server 2:
sudo vi /etc/httpd/conf/httpd.conf
on HA proxy:
vi /etc/haproxy/haproxy.cfg
systemctl restart haproxy
On web servers
sudo firewall-cmd --zone=public --add-port=8008/tcp --permanent
sudo firewall-cmd --reload
I then ensured I could connect to that server on port 8008 directly:
As well as connect to the front end:
on HA proxy:
vi /etc/haproxy/haproxy.cfg
tail -f /var/log/haproxy.log
On web serv2 mv /var/www/html/index.html mv /var/www/html/index2.html mv /var/www/html/index2.html /var/www/html/index.html