# HAproxy configuration for loadbalancing WUVC (Webconsole) between Tomcat servers # HAproxy will 2 do things: # 1. Loadbalancing of Webconsole requests between 2 or more Tomcat servers # 2. Provide one or more failover servers in case a Tomcat server crashes # IMPORTANT: For HAproxy to work with WUVC it is important to have stickiness between the source (desktop that runs UVC) and the Tomcat server (see keywords "stick on src") # Limitation: The loadbalancing is based on the IP address of the desktop, as a consequence all UVC Consoles started with the same IP (same desktop) will connect to the same Tomcat (see keyword "stick-table) # Tested with HA-Proxy version 1.5.4 2014/09/02 # Frontend (http-in) is listening on 8081 and forwarding requests to 2 backends (tomcat_servers) on 8080 # IMPORTANT: Modify the file /webapps//WEB-INF/conf/uvc.vm on each deployed WUVC by adding the *frontend* to the codebase variable, for instance: # # Start HA Proxy with the following command: # haproxy -f -Vdb -p # For instance: haproxy -f /apps/haproxy/haproxy.conf -Vdb -p /apps/haproxy/truc.log global daemon maxconn 256 # at least sum of all maxconn statements in the backend section below defaults mode http # tcp works as well but is a bit slower, but may be more reliable timeout connect 5000ms timeout client 50000ms timeout server 50000ms # To activate logging uncomment the 2 following lines in /etc/rsyslog.conf # #$ModLoad imudp # #$UDPServerRun 514 # and ADD the 2 following lines to the same file: # local0.* -/var/log/haproxy_0.log # local1.* -/var/log/haproxy_1.log log global log 127.0.0.1:514 local0 # rsyslog has to be actiavted to use this, see logs in /var/log/haproxy_0.log frontend http-in # log 127.0.0.1:514 local0 debug # activate rsyslog, see /var/log/haproxy_0.log bind vmst_myfrontend.orsyp.com:8081 default_backend tomcat_servers backend tomcat_servers # log 127.0.0.1:514 local1 debug # activate rsyslog, see /var/log/haproxy_1.log # balance leastconn # only leastconn (without forcing stickiness) fails during authentication on UVMS # balance roundrobin # only roundrobin (without forcing stickiness) fails with half of the requests (when using 2 backend servers) # , with | stick-table type ip size 1m expire 1h stick on src balance leastconn server tom1 vmst_backend_1.orsyp.com:8080 maxconn 128 check inter 60 server tom2 vmst_backend_2.orsyp.com:8080 maxconn 128 check inter 60 # server tom3 vmst_backend_3 ... add as many backends as needed # Activate the HAproxy statistic page accessible on port 8082 of the haproxy server # version, realm and auth can be activated for admins # Stats on http://vmst_frontend.orsyp.com:8082/ listen stats :8082 mode http stats enable stats uri / # stats hide-version # stats realm Haproxy\ Statistics # stats auth Username:Password # login and password for stats page