tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rainer Jung <rainer.j...@kippdata.de>
Subject Re: mod_jk sticky sessions don't work
Date Thu, 02 Aug 2007 15:48:55 GMT
If you configured jvmRoute in server.xml correctly, Tomcat should append 
".portal1" resp. ".portal2" to the session IDs on portal 1 resp. portal2.

 From hte log it looks like this is not happening. So I suspect, either 
something is wrong with your server.xml, or you are talking to another 
Tomcat, or the server.xml wasn't used during the last restart etc.

Before stickyness can work, you need to make jvmRoute in server.xml 
work. To check, if it works, you don't need to use the web server each 
time. You can also connect directly via http to the Tomcat http 
connector and check the ID in the JSESSIONID cookie.

Regards,

Rainer

Claudio Tassini wrote:
> Hi all!
> I'm trying to configure mod_jk to handle balance two apache-tomcat instances
> through an Apache "reverse proxy", i read all the documentation, reference
> guides and howtos i found but it still doesn't work...
> 
> Below are some configuration I'm using. The symptoms are that I connect with
> a browser to a jsp page that prints out the tomcat server that is managing
> the session, and the relative session ID. Every time I refresh the page, the
> server name and the sessionID change.
> 
> I'm using apache httpd 2.2.4 build from source, mod_jk 1.2.23 and
> apache-tomcat 5.5.23 . Now, this is the httpd.conf (relevant parts only):
> 
> 
> JkWorkersFile /usr/local/apache2/conf/workers.properties
> JkShmFile     /usr/local/apache2/logs/mod_jk.shm
> JkLogFile     /usr/local/apache2/logs/mod_jk.log
> JkLogLevel    debug
> JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
> JkOptions +ForwardKeySize +ForwardURICompatUnparsed -ForwardDirectories
> JkRequestLogFormat "%w %V %T"
> NameVirtualHost *:80
> 
> <VirtualHost *:80>
>         ServerName      portal.domain.it
>         JkMount /status status
>         JkMount /*      test
> </VirtualHost>
> 
> The workers.properties:
> 
> worker.list=test
> worker.portal1.port=8009
> worker.portal1.host=inca-portal1
> worker.portal1.type=ajp13
> worker.portal1.lbfactor=1
> worker.portal2.port=8009
> worker.portal2.host=inca-portal2
> worker.portal2.type=ajp13
> worker.portal2.lbfactor=1
> worker.test.type=lb
> worker.test.balance_workers=portal1,portal2
> worker.test.sticky_session=True
> 
> 
> And, finally, I changed the tomcat server.xml file:
> <!-- Define an AJP 1.3 Connector on port 8009 -->
>     <Connector port="8009"
>                enableLookups="false" redirectPort="8443" protocol="AJP/1.3"
> />
> <Engine name="Standalone" defaultHost="localhost" jvmRoute="portal1"
> debug="1" />
> 
> Finally, this is a piece of the log saying that he founds a certain session
> ID, and then he sends the request to the other server which then obviously
> sets a new JSESSIONID... :
> [Thu Aug 02 16:52:09 2007] [1970:44448] [debug]
> map_uri_to_worker::jk_uri_worker_map.c (589): Attempting to map URI
> '/jsp-examples/sesstest.jsp' from 2 maps
> [Thu Aug 02 16:52:09 2007] [1970:44448] [debug]
> map_uri_to_worker::jk_uri_worker_map.c (601): Attempting to map context URI
> '/status=status' source 'JkMount'
> [Thu Aug 02 16:52:09 2007] [1970:44448] [debug]
> map_uri_to_worker::jk_uri_worker_map.c (601): Attempting to map context URI
> '/*=test' source 'JkMount'
> [Thu Aug 02 16:52:09 2007] [1970:44448] [debug]
> map_uri_to_worker::jk_uri_worker_map.c (616): Found a wildchar match
> '/*=test'
> [Thu Aug 02 16:52:09 2007] [1970:44448] [debug] jk_handler::mod_jk.c (2111):
> Into handler jakarta-servlet worker=test r->proxyreq=0
> [Thu Aug 02 16:52:09 2007] [1970:44448] [debug]
> wc_get_worker_for_name::jk_worker.c (114): found a worker test
> [Thu Aug 02 16:52:09 2007] [1970:44448] [debug]
> maintain_workers::jk_lb_worker.c (543): decay with 2^38
> [Thu Aug 02 16:52:09 2007] [1970:44448] [debug]
> wc_get_name_for_type::jk_worker.c (290): Found worker type 'lb'
> [Thu Aug 02 16:52:09 2007] [1970:44448] [debug] init_ws_service::mod_jk.c
> (607): Service protocol=HTTP/1.1 method=GET host=(null) addr=192.168.10.2name=
> portal.inca.it port=80 auth=(null) user=(null) laddr=192.168.10.201 raddr=
> 192.168.10.2
> [Thu Aug 02 16:52:09 2007] [1970:44448] [debug] service::jk_lb_worker.c
> (915): service sticky_session=1 id='64EEDE6D4E3C9EF3A2048741CDA5C189'
> [Thu Aug 02 16:52:09 2007] [1970:44448] [debug]
> get_most_suitable_worker::jk_lb_worker.c (767): searching worker for partial
> sessionid 64EEDE6D4E3C9EF3A2048741CDA5C189
> [Thu Aug 02 16:52:09 2007] [1970:44448] [debug]
> get_most_suitable_worker::jk_lb_worker.c (819): found best worker portal2
> (portal2) using method 'Request'
> [Thu Aug 02 16:52:09 2007] [1970:44448] [debug] service::jk_lb_worker.c
> (935): service worker=portal2 route=portal2
> [Thu Aug 02 16:52:09 2007] [1970:44448] [debug]
> ajp_get_endpoint::jk_ajp_common.c (2343): acquired connection pool slot=0
> [Thu Aug 02 16:52:09 2007] [1970:44448] [debug]
> ajp_marshal_into_msgb::jk_ajp_common.c (548): ajp marshaling done
> [Thu Aug 02 16:52:09 2007] [1970:44448] [debug] ajp_service::jk_ajp_common.c
> (1796): processing portal2 with 2 retries
> [Thu Aug 02 16:52:09 2007] [1970:44448] [debug] ws_write::mod_jk.c (452):
> written 274 out of 274
> [Thu Aug 02 16:52:09 2007] [1970:44448] [debug]
> ajp_connection_tcp_get_message::jk_ajp_common.c (1043): received from ajp13
> pos=0 len=2 max=8192
> [Thu Aug 02 16:52:09 2007] [1970:44448] [debug]
> ajp_connection_tcp_get_message::jk_ajp_common.c (1043): 0000    05 01 00 00
> 00 00 00 00 00 00 00 00 00 00 00 00  - ................
> [Thu Aug 02 16:52:09 2007] [1970:44448] [debug]
> ajp_process_callback::jk_ajp_common.c (1506): AJP13 protocol: Reuse is OK
> [Thu Aug 02 16:52:09 2007] [1970:44448] [debug] ajp_done::jk_ajp_common.c
> (2286): recycling connection pool slot=0 for worker portal2
> [Thu Aug 02 16:52:09 2007] test portal.inca.it 0.005241
> [Thu Aug 02 16:52:09 2007] [1970:44448] [debug] jk_handler::mod_jk.c (2238):
> Service finished with status=200 for worker=test
> 
> 
> Any help would be REALLY appreciated!
> 
> 
> Fi

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message