Search code examples
load-balancingmod-jk

How can I force a request through mod_jk down to a specific worker?


If I have mod_jk set up with several workers and a load balancer worker, is there a request parameter or something that would allow me to force a specific http request down to a specific worker. For instance if I have a worker worker1 is there something like this:

http://www.example.com?worker=worker1

Often we need to troubleshoot problems on a specific server in the cluster and being able to force the request directly to that server is essential.


Solution

    1. Tweak the value of your JSESSIONID cookie. The end has the name of the worker you're stuck to (assuming you're doing sticky sessions)

    2. Use SetHandler as described here http://tomcat.apache.org/connectors-doc/reference/apache.html instead of JKMount directives

      Something like this:

      
         <Location />  
            SetHandler jakarta-servlet  
            SetEnvIf REQUEST_URI ^/.*\?.*worker=(\w+)&?$ JK_WORKER_NAME=$1  
         </Location>