0
                                      /Apache2-->Tomcat 7
                                     /        ---node1--
                                    /
                                   http
                                  /
https/http  --> ApacheLoadBalancer [mod_proxy_http]
                                  \
                                   \    
                                    http
                                     \
                                      \
                                       \Apahe2-->Tomcat 7
                                           ---node2---

                                         .......mode nodes ...  

At present I’m using Apache load balancer mod_proxy_http to balance load between two nodes where each nodes front tomcat7 with apache2 , basically I’m load balancing two Apache nodes . In any of these nodes if tomcat stop/fail for any reason I would like to stop Apache in that node so that load balancer identify the node is not available distribute the load . At present even when tomcat is down in any node since Apache is up(Apache front the tomcat in each node ) load balancer think this node still available and sends requests.. and eventually fail . is there are a way to stop Apache in particular node if backend tomcat fails. One way I thought doing this is to run cron job(keep checking) or Linux script so that when tomcat down I can stop Apache, trying to find out is there a more neat way of doing this ? any ideas . Thanks .

Please note we do use Apache in each node without directly exposing tomcat to load balancer for many reasons One of which is we do use mod proxy again inside fronting Apache to navigate to different tomcat pools

if I narrow down my question unless you have better suggestion . Q: Is there a cleaner way to stop or send signal to fronting Apache2 when backend tomcat is down/fail .

Note : Direct communication between balancer and Tomcat should solve it i know but circumstances are different .

Thanks!

csf
  • 101

1 Answers1

0

The way you should be handling this is having one or more health checks on the load balancer that test the actual tomcat application (could be a jsp ping page, application self-check, etc.).

When the tomcat backend or application fails, the health check page will fail as well. The load-balancer will detect it and stop sending traffic to the backend until it recovers.