Re: Session affinity doesn't work
I post my working configuration set: For every Tomcat I added a jvmRoute like this: Engine jvmRoute=apps1 name=Standalone defaultHost=localhost debug=0 And this is my workers2.properties: ## Define the shared memory file [shm] ver=1 info=Scoreboard. Required for reconfiguration and status with multiprocess servers disabled=0 file=${serverRoot}/logs/jk2.shm size=100 ## Define the communication channels [channel.socket:localhost:9009] ver=34 graceful=1 disabled=0 tomcatId=apps1 lb_factor=10 [channel.socket:apps2.domain1.tld:9009] ver=35 graceful=1 disabled=0 tomcatId=apps2 lb_factor=10 [channel.socket:apps3.domain2.tld:9009] ver=39 graceful=1 disabled=0 tomcatId=apps3 lb_factor=20 [channel.socket:apps4.domain2.tld:9009] ver=7 graceful=1 disabled=0 tomcatId=apps4 lb_factor=20 ## Define workers # Define AJP13 workers [ajp13:localhost:9009] ver=2 disabled=0 info=apps1 - local channel=channel.socket:localhost:9009 group=lb1 [ajp13:apps2.domain1.tld:9009] ver=4 disabled=0 info=apps2 - remote channel=channel.socket:apps2.domain1.tld:9009 group=lb1 [ajp13:apps3.domain2.tld:9009] ver=4 disabled=0 info=apps3 - remote channel=channel.socket:apps3.domain2.tld:9009 group=lb1 [ajp13:apps4.domain2.tld:9009] ver=4 disabled=0 info=apps4 - remote channel=channel.socket:apps4.domain2.tld:9009 group=lb1 # Define Load Balancer worker [lb:lb1] ver=2 disabled=0 info=First load balancer # Define Load Balancer worker [lb:lb2] ver=2 disabled=0 info=Second load balancer worker=ajp13:localhost:9009 worker=ajp13:apps2.domain1.tld:9009 # Define Status worker [status:status] ver=2 disabled=0 ## Define mappings [uri:/xyz1/*] ver=4 disabled=0 group=lb1 #group=ajp13:localhost:9009 [uri:/xyz2/*] ver=6 disabled=0 group=lb1 #group=ajp13:localhost:9009 [uri:/xyz3/*] ver=2 disabled=0 group=ajp13:localhost:9009 [uri:/xyz4/*] ver=4 disabled=0 #group=ajp13:localhost:9009 group=lb2 [uri:/jkstatus/*] ver=2 disabled=0 info=Display status information and checks the config file for changes. group=status:status Thats all Klaus - Original Message - From: Dinh Nguyen [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Monday, October 27, 2003 2:55 AM Subject: RE: Session affinity doesn't work This is my workers2.properties. I attached it to my last mail but the mail server removed it. Sorry for that. == [logger] level=DEBUG [config:] #file=${serverRoot}/conf/workers2.properties #file=c:/Apache2/conf/workers2.properties file=conf/workers2.properties debug=0 debugEnv=0 [shm:] info=Scoreboard. Required for reconfiguration and status with multiprocess servers #file=${serverRoot}/logs/jk2.shm file=logs/jk2.shm size=100 debug=0 disabled=0 [workerEnv:] info=Global server options timing=1 debug=0 # Default Native Logger (apache2 or win32 ) # can be overriden to a file logger, useful # when tracing win32 related issues #logger=logger.file:0 [lb:lb] info=Default load balancer. debug=0 # tomcat1 [channel.socket:localhost:11009] port=11009 host=localhost type=ajp13 lb_factor=100 #tomcatId=tomcat1 : make load balancing not work # tomcat2 [channel.socket:localhost:12009] port=12009 host=localhost type=ajp13 lb_factor=100 #tomcatId=tomcat2 : make load balancing not work # tomcat3 #[channel.socket:psdwdinhnguyen:13009] #port=13009 #host=psdwdinhnguyen #type=ajp13 #lb_factor=100 [uri:/jkstatus/*] info=Display status information and checks the config file for changes. #group=status: [uri:/*.jsp] info=Extension mapping == -Original Message- From: Dinh Nguyen Sent: Monday, October 27, 2003 8:50 AM To: Tomcat Users List Subject: RE: Session affinity doesn't work Hi Klaus, The jvmRoute of the second tomcat instance is tomcat2, I forgot to said that in my first email. About the tomcatId, I modified my settings as you said but now the load balancing no longer works. Only tomcat2 responses to my request. Thank you anyway. Anyone have another idea? Thanks. Dinh. PS: The attachments are my setting files for your reference. server1.xml is server.xml for tomcat1 and server2.xml is server.xml for tomcat2 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Session affinity doesn't work
Hi Klaus, The jvmRoute of the second tomcat instance is tomcat2, I forgot to said that in my first email. About the tomcatId, I modified my settings as you said but now the load balancing no longer works. Only tomcat2 responses to my request. Thank you anyway. Anyone have another idea? Thanks. Dinh. PS: The attachments are my setting files for your reference. server1.xml is server.xml for tomcat1 and server2.xml is server.xml for tomcat2 !-- Example Server Configuration File -- !-- Note that component elements are nested corresponding to their parent-child relationships with each other -- !-- A Server is a singleton element that represents the entire JVM, which may contain one or more Service instances. The Server listens for a shutdown command on the indicated port. Note: A Server is not itself a Container, so you may not define subcomponents such as Valves or Loggers at this level. -- Server port=11005 shutdown=SHUTDOWN debug=0 !-- Comment these entries out to disable JMX MBeans support -- !-- You may also configure custom components (e.g. Valves/Realms) by including your own mbean-descriptor file(s), and setting the descriptors attribute to point to a ';' seperated list of paths (in the ClassLoader sense) of files to add to the default list. e.g. descriptors=/com/myfirm/mypackage/mbean-descriptor.xml -- Listener className=org.apache.catalina.mbeans.ServerLifecycleListener debug=0/ Listener className=org.apache.catalina.mbeans.GlobalResourcesLifecycleListener debug=0/ !-- Global JNDI resources -- GlobalNamingResources !-- Test entry for demonstration purposes -- Environment name=simpleValue type=java.lang.Integer value=30/ !-- Editable user database that can also be used by UserDatabaseRealm to authenticate users -- Resource name=UserDatabase auth=Container type=org.apache.catalina.UserDatabase description=User database that can be updated and saved /Resource ResourceParams name=UserDatabase parameter namefactory/name valueorg.apache.catalina.users.MemoryUserDatabaseFactory/value /parameter parameter namepathname/name valueconf/tomcat-users.xml/value /parameter /ResourceParams /GlobalNamingResources !-- A Service is a collection of one or more Connectors that share a single Container (and therefore the web applications visible within that Container). Normally, that Container is an Engine, but this is not required. Note: A Service is not itself a Container, so you may not define subcomponents such as Valves or Loggers at this level. -- !-- Define the Tomcat Stand-Alone Service -- Service name=Tomcat-Standalone !-- A Connector represents an endpoint by which requests are received and responses are returned. Each Connector passes requests on to the associated Container (normally an Engine) for processing. By default, a non-SSL HTTP/1.1 Connector is established on port 8080. You can also enable an SSL HTTP/1.1 Connector on port 8443 by following the instructions below and uncommenting the second Connector entry. SSL support requires the following steps (see the SSL Config HOWTO in the Tomcat 4.0 documentation bundle for more detailed instructions): * Download and install JSSE 1.0.2 or later, and put the JAR files into $JAVA_HOME/jre/lib/ext. * Execute: %JAVA_HOME%\bin\keytool -genkey -alias tomcat -keyalg RSA (Windows) $JAVA_HOME/bin/keytool -genkey -alias tomcat -keyalg RSA (Unix) with a password value of changeit for both the certificate and the keystore itself. By default, DNS lookups are enabled when a web application calls request.getRemoteHost(). This can have an adverse impact on performance, so you can disable it by setting the enableLookups attribute to false. When DNS lookups are disabled, request.getRemoteHost() will return the String version of the IP address of the remote client. -- !-- Define a non-SSL Coyote HTTP/1.1 Connector on port 8080 Connector className=org.apache.coyote.tomcat4.CoyoteConnector port=8080 minProcessors=5 maxProcessors=75 enableLookups=true redirectPort=8443 acceptCount=100 debug=0 connectionTimeout=2 useURIValidationHack=false disableUploadTimeout=true / -- !-- Note : To disable connection timeouts, set connectionTimeout value to -1 -- !-- Define a SSL Coyote HTTP/1.1 Connector on port 8443 -- !-- Connector className=org.apache.coyote.tomcat4.CoyoteConnector port=8443 minProcessors=5 maxProcessors=75 enableLookups=true acceptCount=100 debug=0
RE: Session affinity doesn't work
This is my workers2.properties. I attached it to my last mail but the mail server removed it. Sorry for that. == [logger] level=DEBUG [config:] #file=${serverRoot}/conf/workers2.properties #file=c:/Apache2/conf/workers2.properties file=conf/workers2.properties debug=0 debugEnv=0 [shm:] info=Scoreboard. Required for reconfiguration and status with multiprocess servers #file=${serverRoot}/logs/jk2.shm file=logs/jk2.shm size=100 debug=0 disabled=0 [workerEnv:] info=Global server options timing=1 debug=0 # Default Native Logger (apache2 or win32 ) # can be overriden to a file logger, useful # when tracing win32 related issues #logger=logger.file:0 [lb:lb] info=Default load balancer. debug=0 # tomcat1 [channel.socket:localhost:11009] port=11009 host=localhost type=ajp13 lb_factor=100 #tomcatId=tomcat1 : make load balancing not work # tomcat2 [channel.socket:localhost:12009] port=12009 host=localhost type=ajp13 lb_factor=100 #tomcatId=tomcat2 : make load balancing not work # tomcat3 #[channel.socket:psdwdinhnguyen:13009] #port=13009 #host=psdwdinhnguyen #type=ajp13 #lb_factor=100 [uri:/jkstatus/*] info=Display status information and checks the config file for changes. #group=status: [uri:/*.jsp] info=Extension mapping == -Original Message- From: Dinh Nguyen Sent: Monday, October 27, 2003 8:50 AM To: Tomcat Users List Subject: RE: Session affinity doesn't work Hi Klaus, The jvmRoute of the second tomcat instance is tomcat2, I forgot to said that in my first email. About the tomcatId, I modified my settings as you said but now the load balancing no longer works. Only tomcat2 responses to my request. Thank you anyway. Anyone have another idea? Thanks. Dinh. PS: The attachments are my setting files for your reference. server1.xml is server.xml for tomcat1 and server2.xml is server.xml for tomcat2 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Session affinity doesn't work
add tomcatId to the channles # tomcat1 [channel.socket:localhost:11009] port=11009 host=localhost type=ajp13 lb_factor=100 tomcatId=tomcat1 # tomcat2 [channel.socket:localhost:12009] port=12009 host=localhost type=ajp13 lb_factor=100 tomcatId=tomcat2 and modify jvmRoute for tomcat2 to Engine name=Standalone defaultHost=localhost debug=0 jvmRoute=tomcat2 Klaus - Original Message - From: Dinh Nguyen [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, October 25, 2003 7:00 AM Subject: Session affinity doesn't work Hi all, I have downloaded these following packages and installed them on my machine (Win 2K): Apache 2.0.47 Tomcat 2.0.47 Jk2_mod connector 2.0.43. I have 2 instances of tomcat (tomcat1, tomcat2 on the same host) on my machine on a load balancing environment. The load balancing works well with one exception: the session affinity doesn't work as expected. Everytime I refresh my browser, it gives me a different session id. If anyone experimented this problem, please help me. These are my settings and modifications to apache and tomcat. Apache httpd.conf == LoadModule jk2_module modules/mod_jk2.dll == Apache workers2.properties (entire content) == [logger] level=DEBUG [config:] #file=${serverRoot}/conf/workers2.properties #file=c:/Apache2/conf/workers2.properties file=conf/workers2.properties debug=0 debugEnv=0 [shm:] info=Scoreboard. Required for reconfiguration and status with multiprocess servers #file=${serverRoot}/logs/jk2.shm file=logs/jk2.shm size=100 debug=0 disabled=0 [workerEnv:] info=Global server options timing=1 debug=0 # Default Native Logger (apache2 or win32 ) # can be overriden to a file logger, useful # when tracing win32 related issues #logger=logger.file:0 [lb:lb] info=Default load balancer. debug=0 # tomcat1 [channel.socket:localhost:11009] port=11009 host=localhost type=ajp13 lb_factor=100 # tomcat2 [channel.socket:localhost:12009] port=12009 host=localhost type=ajp13 lb_factor=100 [uri:/jkstatus/*] info=Display status information and checks the config file for changes. #group=status: [uri:/*.jsp] info=Extension mapping == Tomcat1 server.xml == 1. Comment out Coyote HTTP/1.1 Connector at port 8080 2. Change Server port=8005 shutdown=SHUTDOWN debug=0 to Server port=11005 shutdown=SHUTDOWN debug=0 3. Change Engine name=Standalone defaultHost=localhost debug=0 to Engine name=Standalone defaultHost=localhost debug=0 jvmRoute=tomcat1 (notice: I DID rename the misspelling from jmvRoute to jvmRoute in the orginal release) 4. Change Coyote/JK2 AJP 1.3 Connector to listen at 11009 5. No change for jk2.properties == Tomcat2 server.xml == The same with Tomcat1, but with different port numbers (12005 for server, 12009 for Coyote/JK2 AJP 1.3 Connector) == At the ROOT directory of each tomcat instance, I create a jsp file with a single command request.getSession().getId() Then I start tomcat1, tomcat2, apache (in order). Everything is OK. No error reported on the screen. The only bad thing is that with every request, this page returns a different session id (they are suffixed with .tomcat1 and .tomcat2), if the session affinity works correctly, they must be the same, right? Is there anything wrong with my configuration? If anyone have solution, please share it to me. I appreciate it. Dinh. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Session affinity doesn't work
Hi all, I have downloaded these following packages and installed them on my machine (Win 2K): Apache 2.0.47 Tomcat 2.0.47 Jk2_mod connector 2.0.43. I have 2 instances of tomcat (tomcat1, tomcat2 on the same host) on my machine on a load balancing environment. The load balancing works well with one exception: the session affinity doesn't work as expected. Everytime I refresh my browser, it gives me a different session id. If anyone experimented this problem, please help me. These are my settings and modifications to apache and tomcat. Apache httpd.conf == LoadModule jk2_module modules/mod_jk2.dll == Apache workers2.properties (entire content) == [logger] level=DEBUG [config:] #file=${serverRoot}/conf/workers2.properties #file=c:/Apache2/conf/workers2.properties file=conf/workers2.properties debug=0 debugEnv=0 [shm:] info=Scoreboard. Required for reconfiguration and status with multiprocess servers #file=${serverRoot}/logs/jk2.shm file=logs/jk2.shm size=100 debug=0 disabled=0 [workerEnv:] info=Global server options timing=1 debug=0 # Default Native Logger (apache2 or win32 ) # can be overriden to a file logger, useful # when tracing win32 related issues #logger=logger.file:0 [lb:lb] info=Default load balancer. debug=0 # tomcat1 [channel.socket:localhost:11009] port=11009 host=localhost type=ajp13 lb_factor=100 # tomcat2 [channel.socket:localhost:12009] port=12009 host=localhost type=ajp13 lb_factor=100 [uri:/jkstatus/*] info=Display status information and checks the config file for changes. #group=status: [uri:/*.jsp] info=Extension mapping == Tomcat1 server.xml == 1. Comment out Coyote HTTP/1.1 Connector at port 8080 2. Change Server port=8005 shutdown=SHUTDOWN debug=0 to Server port=11005 shutdown=SHUTDOWN debug=0 3. Change Engine name=Standalone defaultHost=localhost debug=0 to Engine name=Standalone defaultHost=localhost debug=0 jvmRoute=tomcat1 (notice: I DID rename the misspelling from jmvRoute to jvmRoute in the orginal release) 4. Change Coyote/JK2 AJP 1.3 Connector to listen at 11009 5. No change for jk2.properties == Tomcat2 server.xml == The same with Tomcat1, but with different port numbers (12005 for server, 12009 for Coyote/JK2 AJP 1.3 Connector) == At the ROOT directory of each tomcat instance, I create a jsp file with a single command request.getSession().getId() Then I start tomcat1, tomcat2, apache (in order). Everything is OK. No error reported on the screen. The only bad thing is that with every request, this page returns a different session id (they are suffixed with .tomcat1 and .tomcat2), if the session affinity works correctly, they must be the same, right? Is there anything wrong with my configuration? If anyone have solution, please share it to me. I appreciate it. Dinh. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]