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

 

 

 

 

Reply via email to