Using HAProxy to load balance multiple web servers
Load balancers are used to spread a load among a number of servers. Hardware load balancers are still somewhat expensive, whereas software balancers can achieve most of the benefits of a hardware solution.
HAProxy is the software load balancer of choice for most people: fast, powerful, and highly configurable.
My example Vagrantfile will be using Red Hat-based systems for this example, so we'll need to install the selinux
module to configure SELinux:
t@mylaptop $ puppet module install puppet-selinux --modulepath ~/puppet/modules Notice: Preparing to install into /home/thomas/puppet/modules ... Notice: Downloading from https://forgeapi.puppet.com ... Notice: Installing -- do not interrupt ... /home/thomas/puppet/modules └─┬ puppet-selinux (v1.5.2) └── puppetlabs-stdlib (v4.25.0)
How to do it...
In this recipe, I'll show you how to build an HAProxyserver to load balance web requests across web servers. We'll use exported resources to build...