john pfeiffer
  • Home
  • Categories
  • Tags
  • Archives

Haproxy load balancing http https

Easy load balancing... but you'll need a lot of internet research to use all of the features...

apt-get install haproxy

nano /etc/haproxy/haproxy.cfg

global daemon maxconn 4096

defaults mode http contimeout 5000 clitimeout 50000 srvtimeout 50000

HTTP

listen applicationservice 10.10.10.27:80

balance roundrobin

server app1_1 10.10.10.28

server app1_2 10.10.10.29

SSL PRIMARY AND SECONDARY

listen http_proxy :443 mode tcp option ssl-hello-chk balance roundrobin server srv1 10.10.10.28 check inter 30000 rise 1 fall 2 server srv2 10.10.10.29 backup

balance: source = source ip address hashing, roundrobin = random alternation

backup: the server is only used when all other non-backup servers are unavailable


this config needs haproxy-1.1.28 or haproxy-1.2.1

global log 127.0.0.1 local0 log 127.0.0.1 local1 notice #log loghost local0 info maxconn 4096 #chroot /usr/share/haproxy user haproxy group haproxy daemon #debug #quiet

defaults log global mode http option httplog option dontlognull retries 3 option redispatch maxconn 2000 contimeout 5000 clitimeout 50000 srvtimeout 50000

listen applicationservice 10.10.10.243:80 balance roundrobin server app1_1 10.10.10.202 server app1_2 10.10.10.203


nano /etc/default/haproxy

change ENABLED=0 to ENABLED=1


listen webfarm 192.168.0.99:80 mode http stats enable stats auth someuser:somepassword balance roundrobin cookie JSESSIONID prefix option httpclose option forwardfor option httpchk HEAD /check.txt HTTP/1.0 server webA 192.168.0.102:80 cookie A check server webB 192.168.0.103:80 cookie B check


  • « UploadSSL
  • Users groups useradd usermod cmd shell »

Published

Jul 17, 2012

Category

linux

~199 words

Tags

  • balancing 1
  • haproxy 1
  • http 12
  • https 3
  • linux 249
  • load 2