This recipe turns four Raspberry Pis into a highly available website cluster.
Two Raspberry Pis are used as web servers sharing the load of hosting the website. The other two Raspberry Pis are load balancers and they distribute the load of the incoming web requests across the two web servers.
Only one load balancer is required to balance the load. The second is configured to replace the first, if the first load balancer should fail.
The web servers in this recipe use the Apache HTTP server to serve simple stateless websites that demonstrate load balancing in action.
The load balancers in this recipe use HA Proxy to balance web requests between the two web servers and Keepalived to create a virtual IP address for the website that will be automatically redirected to the backup load balancer, if the current load balancer fails.
After completing this recipe, you will have created a highly available website.