Hi all:

I'd posted sometime ago seeking help for a particular requirement.
Rainer Jung replied to my post. The thread is here
http://thread.gmane.org/gmane.comp.jakarta.tomcat.user/144823

Requirement:
1. Host an application on two tomcat instances.
2. Enable load balancing between these two Tomcat instances.
3. If one Tomcat instance goes down then the other should take over.
4. If the second goes down, then the first should be retried. This
should happen even if the first had failed some time ago.
5. After both the Tomcat instances are retried a number of times, fall
back to yet another Tomcat. This third tomcat could do some special
processing.

Solution:
mod_jk gives us this out of the box.

For load balancing, add the first two Tomcat instances
                               worker.router.balance_workers=worker1,worker2

For fail over between the two instances, do nothing extra

For making only the first one work, and to use the second instance
only for fail over, mark the second instance as disabled.
worker.worker2.activation=disabled

For ensuring that mod_jk tries both the Tomcat instances a specified
number of times before moving to the third Tomcat instance.
ensure that the first two Tomcat instances have the same distance
count, while the Third tomcat instance has a higher distance count.

worker.worker1.distance=0
worker.worker2.distance=0
worker.worker3.distance=1

I've attached the worker.properties file below for reference.

================================== worker.properties =============
# The advanced router LB worker
worker.list=router

# Define a worker using ajp13
worker.worker1.port=8009
worker.worker1.recovery_options=0
worker.worker1.host=192.168.11.26
worker.worker1.type=ajp13
worker.worker1.lbfactor=1
worker.worker1.retries=3
worker.worker1.fail_on_status=600
worker.worker1.distance=0
worker.worker1.mount=/mondrian/*

# Define prefered failover node for worker1
worker.worker1.redirect=worker2

# Define another worker using ajp13
worker.worker2.port=8009
worker.worker2.recovery_options=0
worker.worker2.host=192.168.11.25
worker.worker2.type=ajp13
worker.worker2.lbfactor=1
worker.worker2.retries=3
worker.worker2.fail_on_status=600
worker.worker2.distance=0
worker.worker2.mount=/mondrian/*

# Disable worker2 for all requests except failover. Comment out the
following to enable the 2 node load-balancing
# worker.worker2.activation=disabled

# Define the last resort worker using ajp13
worker.worker3.port=8009
worker.worker3.recovery_options=0
worker.worker3.host=192.168.11.24
worker.worker3.type=ajp13
worker.worker3.lbfactor=1
worker.worker3.retries=3
worker.worker3.fail_on_status=600
worker.worker1.distance=1
worker.worker3.mount=/mondrian/*


# Define the LB worker
worker.router.type=lb
worker.router.sticky_session=0
#worker.router.sticky_session_force=0
worker.router.balance_workers=worker1,worker2
worker.list=jkstatus

# Define a 'jkstatus' worker using status
worker.jkstatus.type=status

---------------------------------------------------------------------
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