Subject: Integrate Apache httpd with Tomcat plus failover
Author: Linux
In response to: Who should go online first, Apache httpd or Tomcat?
Posted on: 11/02/2011 07:12:46 PM
------- ----------
www.exmaple1.com ---| | | |
| | mod_jk | tomcat |
| httpd |------------|(primary) |
www.exmaple2.com ---| | | | |
|_______| | |__________|
|
| ----------
| | |
| | tomcat |
|--|(failover)|
| |
|__________|
A load balancer is a worker that does not directly communicate with Tomcat. Instead it is responsible for the management of several "real" workers, called members or sub workers of the load balancer.
A practical example given here is to use loadbalancer to provide high-availability service with a failover tomcat server.
# The dvanced router LB worker
worker.list=router
worker.router.type=lb
worker.router.balance_workers=worker1,worker2
# Define the first member worker
worker.worker1.type=ajp13
worker.worker1.host=myhost1
worker.worker1.port=8009
# Define preferred failover node for worker1
worker.worker1.redirect=worker2
# Define the second member worker
worker.worker2.type=ajp13
worker.worker2.host=myhost2
worker.worker2.port=8009
# Disable worker2 for all requests except failover
worker.worker2.activation=disabled
The
redirect flag on
worker1 tells the load balancer to redirect the requests to
worker2 in case that
worker1 has a problem. In all other cases
worker2 will
not receive any requests, thus acting like a hot standby.
>
> On 10/26/2011 12:52:23 AM
Linux wrote:
Always start or restart Tomcat first, then Apache httpd.
References: