Hi Philipp,

Philipp Kemper schrieb:
Hello,

I'm running Apache 1.3 with mod_jk 1.2.7-dev and three instances of Tomcat
6.0.14.

Because I experienced that after a certain time some database connections
are not closed properly and the memory use increases, we decided to restart
the Tomcat completely. But in order to have no downtime and to be able to
serve all sessions, I made a special setup.

We have 3 configurations for mod_jk:

workers.properties-01:

workers.tomcat_home=/u/www/WWW/einsurance/tomcat-01

workers.java_home=/usr/java

ps=/

worker.list=loadbalancer

worker.ajp13-01.port=11001

worker.ajp13-01.host=tomcathost-01

worker.ajp13-01.type=ajp13

worker.ajp13-01.lbfactor=1

worker.ajp13-01.local_worker=1

worker.ajp13-01.socket_keepalive=1

worker.ajp13-02.port=11002

worker.ajp13-02.host=tomcathost-02

worker.ajp13-02.type=ajp13

worker.ajp13-02.lbfactor=1

worker.ajp13-02.local_worker=0

worker.ajp13-02.socket_keepalive=1

worker.ajp13-03.port=11003

worker.ajp13-03.host=tomcathost-03

worker.ajp13-03.type=ajp13

worker.ajp13-03.lbfactor=1

worker.ajp13-03.local_worker=0

worker.ajp13-03.socket_keepalive=1

worker.loadbalancer.type=lb

worker.loadbalancer.balanced_workers=ajp13-01, ajp13-02, ajp13-03

worker.loadbalancer.local_worker_only=0

workers.properties-02:

workers.tomcat_home=/u/www/WWW/einsurance/tomcat-01

workers.java_home=/usr/java

ps=/

worker.list=loadbalancer

worker.ajp13-01.port=11001

worker.ajp13-01.host=tomcathost-01

worker.ajp13-01.type=ajp13

worker.ajp13-01.lbfactor=1

worker.ajp13-01.local_worker=0

worker.ajp13-01.socket_keepalive=1

worker.ajp13-02.port=11002

worker.ajp13-02.host=tomcathost-02

worker.ajp13-02.type=ajp13

worker.ajp13-02.lbfactor=1

worker.ajp13-02.local_worker=1

worker.ajp13-02.socket_keepalive=1

worker.ajp13-03.port=11003

worker.ajp13-03.host=tomcathost-03

worker.ajp13-03.type=ajp13

worker.ajp13-03.lbfactor=1

worker.ajp13-03.local_worker=0

worker.ajp13-03.socket_keepalive=1

worker.loadbalancer.type=lb

worker.loadbalancer.balanced_workers=ajp13-01, ajp13-02, ajp13-03

worker.loadbalancer.local_worker_only=0

workers.properties-03:

workers.tomcat_home=/u/www/WWW/einsurance/tomcat-01

workers.java_home=/usr/java

ps=/

worker.list=loadbalancer

worker.ajp13-01.port=11001

worker.ajp13-01.host=tomcathost-01

worker.ajp13-01.type=ajp13

worker.ajp13-01.lbfactor=1

worker.ajp13-01.local_worker=0

worker.ajp13-01.socket_keepalive=1

worker.ajp13-02.port=11002

worker.ajp13-02.host=tomcathost-02

worker.ajp13-02.type=ajp13

worker.ajp13-02.lbfactor=1

worker.ajp13-02.local_worker=0

worker.ajp13-02.socket_keepalive=1

worker.ajp13-03.port=11003

worker.ajp13-03.host=tomcathost-03

worker.ajp13-03.type=ajp13

worker.ajp13-03.lbfactor=1

worker.ajp13-03.local_worker=1

worker.ajp13-03.socket_keepalive=1

worker.loadbalancer.type=lb

worker.loadbalancer.balanced_workers=ajp13-01, ajp13-02, ajp13-03

worker.loadbalancer.local_worker_only=0

Sticky Sessions are activated and necessary!

Every 2 minutes a shell script (via crontab) is executed that checks whether
all three instances (Tomcat-01, Tomcat-02, Tomcat-03) are running.

If not all instances are running, the script starts the first (only one each
time) instance from his list, that is not running (Is Tomcat-01 running? Is
Tomcat-02 running? Is Tomcat-03 running?).

If it has to start the third instance, it sets an at job that kills the
oldest Tomcat after 60 minutes.

Then it links the properties file to the specific workers.properties pasted
above (e.g. workers.properties -> workers.properties-02 when Tomcat-02 is
started) and gracefully restarts Apache.

The effect is that the recently started Tomcat gets the new sessions (and
only he!) because it's workers.properties file has been linked. Because of
sticky sessions, no older session gets lost and is still served by the
appropriate Tomcat. It's important that only the newest Tomcat gets the new
sessions because the oldest Tomcat will be killed by an at job (and sessions
must never get lost). When he gets restarted it automatically takes over the
new sessions.

The problem now is that local_worker_only and local_worker have been removed
in newer versions of mod_jk.

Is there any way to realise my current setup with the new configuration
flags of workers.properties?

Greetings

Philipp

Yes:

1) Direct migration of the config:

local_worker=1 -> distance=0
local_worker=0 -> distance=1
local_worker_only=0 -> -

This will behave the same, as your config.

2) Use activation attribute:

activation=d (or disabled)

lb does not use this member for requests, which do not belong to a session

activation=s (or stopped)

lb does not use this member for any request

activation=a (or active)

lb can use this member whenever it likes

Caution: the lb doesn't know if a session is valid. It simply looks for the presence of a session cookie or URL encoded session, when it checks, if it is allowed to send it to a disabled worker or not.

Setting activation to disabled usually means that the node dries out (the number of active session decreases until it gets very low).

Regards,

Rainer




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

Reply via email to