O'Reilly logo

Puppet 3 Cookbook by John Arundel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using HAProxy to load-balance multiple web servers

Once upon a time a load balancer was a big box that sat in a rack and cost eighty thousand dollars. Although you can still buy those, for most organizations a software load balancer solution using commodity Linux servers is a better value proposition.

HAProxy is the software load balancer of choice for most people: fast, powerful, and highly configurable.

How to do it…

In this recipe, I'll show you how to build an HAProxy server to load-balance web requests across two existing backend servers.

  1. Run the following commands:
    ubuntu@cookbook:~/puppet$ mkdir -p modules/haproxy/manifests
    ubuntu@cookbook:~/puppet$ mkdir -p modules/haproxy/files
    
  2. Create the file modules/haproxy/manifests/init.pp with the following ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required