3 Replies Latest reply on Jan 27, 2011 12:09 PM by rudyamid

    Sticky session with proxypass

      Hello,

       

      I installed mod_cluster 1.1.0.CR1 (binary package for linux x86) and tomcat 6 (JDK 1.6.0_20). Note that I had to apply patch MODCLUSTER-143 and re-build the java side in order to run mod_cluster with tomcat.

       

      mod_cluster works just fine when configured with CreateBalancers set to 2.

      But when CreateBalancers is set to 1 and ProxyPass is used to define the cluster name in a virtualhost then the session is no more sticky and requests are balanced to all back-end tomcats.

       

      I enabled httpd debug (see attached log file) and figured out that even though the JSESSIONID cookie is found, mod_cluster does not found any route and a new session (new JSESSIONID cookie) is created for each requests.

       

      I tried different proxypass/proxypassmatch configurations but I was not able to enable sticky session. Am I missing something with the proxypass directive?

       

      Thanks for your help.

       

      Tomcat routes

      <Engine name="Catalina" defaultHost="localhost" jvmRoute="tomcat1">
      <Engine name="Catalina" defaultHost="localhost" jvmRoute="tomcat2">

       

      Tomcat mod_cluster listener

      <Listener className="org.jboss.modcluster.catalina.ModClusterListener"
              balancer="mycluster"
              advertise="false"
              proxyList="192.168.20.128:6666,192.168.20.129:6666"
              stickySession="true"
              excludedContexts="ROOT,manager,host-manager"
              />

       

      Apache mod_cluster configuration

      Listen *:6666
      <VirtualHost *:6666>

       

              KeepAliveTimeout 60
              MaxKeepAliveRequests 0

       

              CreateBalancers 1
              AdvertiseFrequency 5

       

              ServerAdvertise Off

       

              <Location />
                      Order Deny,Allow
                      Allow from All
              </Location>

       

              <Location /mod_cluster-manager>
                      SetHandler mod_cluster-manager
                      Order deny,allow
                      Allow from all
              </Location>

       

      </VirtualHost>

       

      Listen *:6667
      <VirtualHost *:6667>
              <Location />
                      Order Deny,Allow
                      Allow from All
              </Location>


              ProxyPass /tests/ balancer://mycluster/tests/ stickysession=JSESSIONID|jsessionid
      </VirtualHost>