3

I'm trying to set up a load balancer with HAProxy, but I'm having trouble understanding how to configure it. Can someone provide an example configuration?

1
  • Out of the box, HAProxy can operate on HTTP/HTTPS or TCP or UDP. these three different types of operation are very different. You didn't say what kind of traffic you were trying to load balance, nor provide details of what you tried / why it did not work.
    – symcbean
    Apr 30 at 8:22

1 Answer 1

3

Here is a sample configuration:

global
    slowlog_flat 100

defaults
    mode http
    timeout connect 5000ms
    timeout client  50000ms
    timeout server  50000ms

frontend http
    bind *:80,*:443
    default_backend servers

backend servers
    balance roundrobin
    server server1 192.168.1.100:80 weight 1 check
    server server2 192.168.1.101:80 weight 1 check
1
  • 1
    Don't delete it, answering your own question is encouraged and helps others :) Apr 20 at 18:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .