Load Balancing Lab - echadbourne/NET-330 GitHub Wiki
I downloaded each of the VMs, fired up the centos ones, and gave them IP addresses. they were able to ping between each other so I made almost identical pages on them, with the number being different on the respective server
I then started the httpd service on both of them with sudo systemctl start httpd
For the haproxy server, I started it, ran dhclient
to get it an ip address, pinged the other servers, and then edited the /etc/haproxy/haproxy.cfg file to say the following:
I then restarted the service, and went to the ip address of the load balancer, and each of my servers were showing there
Logging
In /etc/rsyslog.conf I made the following changes:
I also restarted haproxy, and did a tail -f /var/log/haproxy.log
to see the server connections. Here are the logs:
Health Checks
Go to the /etc/haproxy/haproxy.cfg
Add check after the server definitions
Watch the logs and turn things on and off - both the server, and the service
Additional Configurations
Go to /etc/httpd/conf/httpd.conf on each of the servers and change the listening port to 8008
Change the port in haproxy
On the servers allow port 8008 with firewall-cmd --add-port=8008/tcp
Restart both httpd on both servers and haproxy
Add a line to do a HEAD check on a certain url (note, the host field is required but is not used in this case and does not need to be the server its checking)
restart haproxy
Layer 7 down and up log