tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Derrick Koes" <Derrick_K...@skillsoft.com>
Subject Sticky sessions and URL rewriting
Date Tue, 14 Dec 2004 23:21:18 GMT

Now that JK2 isn't supported, I'm attempting to get my code to work with JK.  The issue I've
come across is that if I use URL rewriting (i.e. no cookies), which I've always done, with
JK (I blame it because it's the only new variable) Tomcat does not seem to pick up the session
from the URL.  First, is listed my configuration with JK2 and then the config from JK.  I
really can't explain why Tomcat doesn't do what I expect when I swap out connectors.

JK2:

 # +++++++++++++++++++++++++++ BEGIN CONFIGURATION ++++++++++++++++++++++++++
# 
# The following configuration file describes a JK2 installation
# which does round-robin, session-aware load balancing across all
# defined workers.  Having a single work will balance the load on
# that worker.  This is the default, even if you don't spell it out,
# but it is spelled out here for clarity.  @TODO indicates a 
# configuration must be made here.  @OPTIONAL indicates an optional
# customization may be made.
#

#
# Define the status worker, used with the URI: /jkstatus 
# This is useful for testing the health of the connector, and for 
# getting performance statistics
#
# @OPTIONAL: if you don't want a /jkstatus report, omit
#
[status:status]

#
# (1) Create a logger.
# @OPTIONAL: You may customize the path if you wish.
#
[logger.file:0]
level=INFO
file=D:/jakarta-tomcat-5.0.28/logs/isapi_filter.log

#
# (2) Define a load balancer worker
# @OPTIONAL: You may add  "debug=9" for triage, if needed
#
[lb:lb]
stickySession=1

#
# (3) Define a communication channel to tomcat
#
# @TODO: 
# 1. Replace "@TODO-tomcat-server" with the tomcat server host name
# 2. Update the corresponding tomcat configuration file (${CATALINA_HOME/conf/server.xml):
#    Find the line '<Engine ... name="Catalina" ...>' and add the element
#    jvmRoute="@TODO-tomcat-server:8009" >.  The value of jvmRoute must
#    match the "tomcatId" below, or stick session load balancing will not work.
#
#    ** NB ** The value of the jvmRoute parameter must not contain
#             embedded dot characters (".") (i.e., the fully-qualified
#             domain name.)  Doing so will cause JK2 load balancing to fail.
#
# @TODO: Change the host name as appropriate
#
# @OPTIONAL: You may add  "debug=9" for triage, if needed
#
[channel.socket:dkoesxp:8009]
info=AJP13 forwarding over socket
tomcatId=dkoesxp:8009

#
# (4) Define a worker which communicates over the channel above
#
# @TODO: Change the host name as appropriate
#
# @OPTIONAL: Changing the lbfactor affects the weighted round-robin 
# load balancing.  Higher numbers means stronger machine which will
# receive more of the requests.
#
# @OPTIONAL: You may add  "debug=9" for triage, if needed
#
[ajp13:dkoesxp:8009]
channel=channel.socket:dkoesxp:8009
lbfactor=1

#
# @OPTIONAL: Repeat steps (3) and (4) here for every tomcat server
# to participate in load balancing.  At least one is required.
# 
# For example, if the load on the single server defined above
# is too great, configure a similar server, and repeat steps (3) and (4)
# to include the new server in the load balancing.
#
# --------------------------- END   CONFIGURATION --------------------------

# +++++++++++++++++++++++++++    BEGIN MAPPING    ++++++++++++++++++++++++++
#
# (5) Map URIs to be forwarded.  
#
# @TODO: For each context deployed on the tomcat-server(s) above,
# define a mapping to be forwarded.
#
# @OPTIONAL: You may add  "debug=9" for triage, if needed
#
# @OPTIONAL: You may change the info= to be descriptive of this application.
#
[uri:/ilt/*]
info=JK2-enabled-application installed under /ilt

# ---------------------------     END  MAPPING    --------------------------

# +++++++++++++++++++++++++++ /jkstatus MAPPING   ++++++++++++++++++++++++++
#
# @OPTIONAL: This provides a status report on the JK2 connector.  Remove
# if you don't want this available.
#
[uri:/jkstatus/*]
worker=status:status

# --------------------------- /jkstatus MAPPING   --------------------------



JK (1.2.6):

# +++++++++++++++++++++++++++ BEGIN CONFIGURATION ++++++++++++++++++++++++++
# 
# The following configuration file describes a JK installation
# which does round-robin, session-aware load balancing across all
# defined workers.  Having a single worker will balance the load on
# that worker.  This is the default, even if you don't spell it out,
# but it is spelled out here for clarity.  @TODO indicates a 
# configuration must be made here.  @OPTIONAL indicates an optional
# customization may be made.
#
# workers.properties -
#
#   Copyright 1999-2004 The Apache Software Foundation
# 
#   Licensed under the Apache License, Version 2.0 (the "License");
#   you may not use this file except in compliance with the License.
#   You may obtain a copy of the License at
# 
#       http://www.apache.org/licenses/LICENSE-2.0
# 
#   Unless required by applicable law or agreed to in writing, software
#   distributed under the License is distributed on an "AS IS" BASIS,
#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#   See the License for the specific language governing permissions and
#   limitations under the License.
#
#
# This file provides jk derived plugins with the needed information to
# connect to the different tomcat workers.  Note that the distributed
# version of this file requires modification before it is usable by a
# plugin.
#
# As a general note, the characters $( and ) are used internally to define
# macros. Do not use them in your own configuration!!!
#
# Whenever you see a set of lines such as:
# x=value
# y=$(x)\something
#
# the final value for y will be value\something
#
# Normaly all you will need to do is un-comment and modify the first three
# properties, i.e. workers.tomcat_home, workers.java_home and ps.
# Most of the configuration is derived from these.
#
# When you are done updating workers.tomcat_home, workers.java_home and ps
# you should have 3 workers configured:
#
# - An ajp12 worker that connects to localhost:8007
# - An ajp13 worker that connects to localhost:8009
# - A jni inprocess worker.
# - A load balancer worker
#
# However by default the plugins will only use the ajp12 worker. To have
# the plugins use other workers you should modify the worker.list property.
#
#

# OPTIONS ( very important for jni mode ) 

#
# workers.tomcat_home should point to the location where you
# installed tomcat. This is where you have your conf, webapps and lib
# directories.
#
workers.tomcat_home=C:\jakarta-tomcat-5.0.28

#
# workers.java_home should point to your Java installation. Normally
# you should have a bin and lib directories beneath it.
#
workers.java_home=C:\j2sdk1.4.2_04

#
# You should configure your environment slash... ps=\ on NT and / on UNIX
# and maybe something different elsewhere.
#
ps=\

#
#------ ADVANCED MODE ------------------------------------------------
#---------------------------------------------------------------------
#

#
#------ DEFAULT worket list ------------------------------------------
#---------------------------------------------------------------------
#
#
# The workers that your plugins should create and work with
# 
worker.list=loadbalancer

#
#------ DEFAULT ajp13 WORKER DEFINITION ------------------------------
#---------------------------------------------------------------------
#

#
# Defining a worker named dkoesxp:8009 and of type ajp13
# Note that the name and the type do not have to match.
#
worker.dkoesxp:8009.port=8009
worker.dkoesxp:8009.host=dkoesxp
worker.dkoesxp:8009.type=ajp13
#
# Specifies the load balance factor when used with
# a load balancing worker.
# Note:
#  ----> lbfactor must be > 0
#  ----> Low lbfactor means less work done by the worker.
worker.dkoesxp:8009.lbfactor=100

#
# Specify the size of the open connection cache.
#worker.dkoesxp:8009.cachesize

#
#------ DEFAULT LOAD BALANCER WORKER DEFINITION ----------------------
#---------------------------------------------------------------------
#

#
# The loadbalancer (type lb) workers perform wighted round-robin
# load balancing with sticky sessions.
# Note:
#  ----> If a worker dies, the load balancer will check its state
#        once in a while. Until then all work is redirected to peer
#        workers.
worker.loadbalancer.type=lb
worker.loadbalancer.balanced_workers=dkoesxp:8009
worker.loadbalancer.sticky_session=1

(uriworkermap.properties)

/ilt=loadbalancer
/ilt/*=loadbalancer

Mime
View raw message