This section describes Apache with mod_jk as a solution for load balancing in an OLAT cluster. You are free to use any other load balancer (hard- or software) as long as certain criterias are met (see below).
Refer to http://tomcat.apache.org/connectors-doc/generic_howto/workers.html for details
Criterias for the Load Balancer
Session stickyness: The OLAT Cluster requires session stickyness to be configured to make sure a particular user is always routed to the same tomcat instance.
Apache and one tomcat instance must run on same host: Static files (those under /olat/raw) can be served by Apache directly and do not need to take a detour via tomcat. Hence apache needs to be configured to serve /olat/raw directly from a tomcat instance on the same host. In order to do this you must install an OLAT node at least once on the host where you run apache - it does not necessary have to be included in the load balancing but it must be started once in order to populate the /olat/raw/* directories.
Example configuration of Apache with mod_jk
mod_jk.conf:
<IfModule mod_jk.c> JkRequestLogFormat "%w %V %T %r" JkWorkersFile "/modjkdirectory/workers.properties" JkLogFile "/logdirectory/mod_jk.log" JkShmFile "/modjkdirectory/mod_jk-runtime-status" JkLogLevel error JkOptions +ForwardURICompatUnparsed JkMount /olat/* loadbalancerworker JkMount /olat loadbalancerworker JkUnMount /olat/raw/* loadbalancerworker ... </IfModule>
Make sure to JkMount the loadbalancerworker under /olat
Make sure to JkUnMount the raw directory /olat/raw
workers.properties:
workers.tomcat_home=/usr/local/opt/tomcat-6.0 workers.java_home=/usr/local/opt/java-1.6 ps=/ worker.list=loadbalancerworker worker.loadbalancerworker.type=lb worker.loadbalancerworker.balance_workers=tomcatolat02,tomcatolat01 worker.loadbalancerworker.sticky_session=true worker.loadbalancerworker.sticky_session_force=false worker.loadbalancerworker.method=s worker.loadbalancerworker.connect_timeout=15000 worker.loadbalancerworker.prepost_timeout=15000 worker.basic.type=ajp13 worker.basic.socket_timeout=1200 worker.basic.cachesize=1 worker.basic.cache_timeout=1300 worker.basic.recycle_timeout=1300 worker.basic.port=8009 worker.basic.distance=10 worker.basic.lbfactor=10 worker.basic.connect_timeout=30000 worker.basic.prepost_timeout=30000 worker.tomcatolat01.host=localhost worker.tomcatolat01.port=8019 worker.tomcatolat01.domain=tomcatolat01 worker.tomcatolat01.reference=worker.basic worker.tomcatolat01.lbfactor=10 worker.tomcatolat02.host=localhost worker.tomcatolat02.port=8029 worker.tomcatolat02.domain=tomcatolat02 worker.tomcatolat02.reference=worker.basic worker.tomcatolat02.lbfactor=10
Add the loadbalancerworker under worker.list and all OLAT nodes under worker.loadbalancerworker.balance_workers
Configuring connect_timeout and prepost_timeout instructs mod_jk to detect a deadlock or crash in an OLAT node