# load balancing configuration global log 127.0.0.1 local6 debug maxconn 32000 # number of resources required is related to number of connections. Therefore, we must set a connection limit ahead of time daemon # run as a background process quiet # don't send messages to the console pidfile /var/run/haproxy-private.pid stats enable # Configure the monitoring page @ http://10.2.16.240/haproxy?stats listen stats 10.98.33.1:8080 maxconn 30 mode http option httpclose transparent stats auth admin:password # client time-out set to 10s. clitimeout 10000 # server time-out set to 10s. srvtimeout 10000 # we give up if the connection does not complete within 4 seconds contimeout 4000 # define services for haproxy to listen on # This is the publc loadbalanced service for dynamic content listen www_proxy :80 maxconn 20000 mode http option httpclose option httplog option forwardfor cookie OURSVRID insert indirect nocache balance roundrobin option httpchk HEAD /online # Declare each server twice. Once with the check params and once declared as backups # When the "online" file is present, new sessions will be assigned to that server # When the "online" file is absent, new sessions will not be assigned to that server # but existing sessions that share the same cookie name will be assigned to it's backup server. # If none of the backup servers that have cookies exist, then new sessions will get routed to the # "sorry server" ### Define Online Server Instances ### server web1 10.98.33.30:8080 cookie s01 weight 1 check inter 2500 rise 2 fall 2 server web2 10.98.33.31:8080 cookie s02 weight 1 check inter 2500 rise 2 fall 2 server web3 10.98.33.32:8080 cookie s03 weight 1 check inter 2500 rise 2 fall 2 server web3a 10.98.33.32:9090 cookie s03.1 weight 1 check inter 2500 rise 2 fall 2 server db2 10.98.31.23:8080 cookie s04 weight 1 check inter 2500 rise 2 fall 2 server db2a 10.98.31.23:9090 cookie s04.1 weight 1 check inter 2500 rise 2 fall 2 # Define "sorry server" - last resort server outage 127.0.0.1:80 check backup ### Define backup server instances which will be used in order of declaration unless a matching cookie exists ### server web1 10.98.33.30:8080 cookie s01 backup server web2 10.98.33.31:8080 cookie s02 backup server web3 10.98.33.32:8080 cookie s03 backup server web3a 10.98.33.32:9090 cookie s03.1 backup server db2 10.98.31.23:8080 cookie s04 backup server db2a 10.98.31.23:9090 cookie s04.1 backup redispatch # send back to dispatch in case of connection failure option abortonclose # client time-out set to 60s. clitimeout 60000 # server time-out set to 60s. srvtimeout 60000 # we give up if the connection does not complete within 4 seconds contimeout 2500 # duplicate config of public dynamic service lets us put some servers behind a testing url listen testing_proxy :80 maxconn 1000 mode http option httpclose option httplog option forwardfor cookie OURSVRID insert indirect postonly balance roundrobin option httpchk HEAD /testing.online # Declare each server twice. Once with the check params and once declared as backups # When the "online" file is present, new sessions will be assigned to that server # When the "online" file is absent, new sessions will not be assigned to that server # but existing sessions that share the same cookie name will be assigned to it's backup server. # If none of the backup servers that have cookies exist, then new sessions will get routed to the # "sorry server" ### Define Online Server Instances ### server web1 10.98.33.30:8080 cookie st1 weight 1 check inter 60000 rise 2 fall 2 server web2 10.98.33.31:8080 cookie st2 weight 1 check inter 60000 rise 2 fall 2 server web3 10.98.33.32:8080 cookie st3 weight 1 check inter 60000 rise 2 fall 2 server web3a 10.98.33.32:9090 cookie st3.1 weight 1 check inter 60000 rise 2 fall 2 server db2 10.98.31.23:8080 cookie st4 weight 1 check inter 2500 rise 2 fall 2 server db2a 10.98.31.23:9090 cookie st4.1 weight 1 check inter 2500 rise 2 fall 2 # Define "sorry server" - last resort server outage 127.0.0.1:80 check backup ### Define backup server instances which will be used in order of declaration unless a matching cookie exists ### server web1 10.98.33.30:8080 cookie st1 backup server web2 10.98.33.31:8080 cookie st2 backup server web3 10.98.33.32:8080 cookie st3 backup server web3a 10.98.33.32:9090 cookie st3.1 backup server db2 10.98.31.23:8080 cookie st4 backup server db2a 10.98.31.23:9090 cookie st4.1 backup redispatch # send back to dispatch in case of connection failure option abortonclose # client time-out set to 60s. clitimeout 60000 # server time-out set to 60s. srvtimeout 60000 # we give up if the connection does not complete within 4 seconds contimeout 2500 # This is the publc loadbalanced service for static content listen static_proxy :80 maxconn 20000 mode http option httpclose option httplog option forwardfor balance roundrobin option httpchk HEAD /online server web1 10.98.33.30:80 weight 1 check inter 2500 rise 2 fall 2 server web2 10.98.33.31:80 weight 1 check inter 2500 rise 2 fall 2 server web3 10.98.33.32:80 weight 1 check inter 2500 rise 2 fall 2 server outage 127.0.0.1:80 check backup redispatch # send back to dispatch in case of connection failure option abortonclose # client time-out set to 60s. clitimeout 30000 # server time-out set to 60s. srvtimeout 30000 # we give up if the connection does not complete within 4 seconds contimeout 1500 # These are the services for jabber listen xmpp_admin 10.98.31.201:5280 maxconn 5000 mode http option httpclose option httplog log 127.0.0.1 local6 balance roundrobin server xmpp1 10.98.31.20:5280 weight 1 check inter 2000 rise 2 fall 2 server xmpp2 10.98.31.21:5280 weight 1 check inter 2000 rise 2 fall 2 redispatch # send back to dispatch in case of connection failure option abortonclose # client time-out set to 20s. clitimeout 20000 # server time-out set to 20s. srvtimeout 20000 # we give up if the connection does not complete within 4 seconds contimeout 4000 listen xmpp_client 10.98.31.201:5222 maxconn 20000 mode tcp option tcplog log 127.0.0.1 local6 balance roundrobin server xmpp1 10.98.31.20:5222 check inter 2000 port 5222 server xmpp2 10.98.31.21:5222 check inter 2000 port 5222 # This is the publc loadbalanced service for blog listen blog_proxy :80 maxconn 5000 mode http option httpclose option httplog option forwardfor cookie OURSVRID insert indirect postonly balance roundrobin option httpchk HEAD /ping.jsp server web1 10.98.33.30:9080 cookie s01 weight 1 check inter 2500 rise 2 fall 2 server web2 10.98.33.31:9080 cookie s02 weight 1 check inter 2500 rise 2 fall 2 server outage 127.0.0.1:80 check backup redispatch # send back to dispatch in case of connection failure option abortonclose # client time-out set to 60s. clitimeout 60000 # server time-out set to 60s. srvtimeout 60000 # we give up if the connection does not complete within 4 seconds contimeout 4000