Skip to content

Instantly share code, notes, and snippets.

@kenshinx
Created January 15, 2014 09:29
Show Gist options
  • Save kenshinx/8433294 to your computer and use it in GitHub Desktop.
Save kenshinx/8433294 to your computer and use it in GitHub Desktop.
Haproxy load balance. haproxy:123.125.22.97 server1:123.125.22.99 server2:123.125.22.100
# this config needs haproxy-1.1.28 or haproxy-1.2.1
global
log 127.0.0.1 local3 debug
#log 127.0.0.1 local1 notice
#log loghost local0 info
maxconn 65535
#chroot /usr/share/haproxy
user haproxy
group haproxy
daemon
nbproc 1
pidfile /var/run/haproxy.pid
#debug
#quiet
defaults
log global
mode http
option httplog
option dontlognull
retries 3
redispatch
stats enable
stats uri /haproxy-status
stats refresh 5s
maxconn 2000
contimeout 5000
clitimeout 50000
srvtimeout 50000
listen swaf-loadbalance 0.0.0.0:80
cookie SERVERID rewrite
balance roundrobin
server swaf_99 123.125.22.99:80 cookie app1inst1 check inter 2000 rise 2 fall 5
server sawf_100 123.125.22.100:80 cookie app1inst2 check inter 2000 rise 2 fall 5
@kenshinx
Copy link
Author

haproxy:123.125.22.97
server1:123.125.22.99
server2:123.125.22.100

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment