I have setup apache-tomcat clustering(Ubuntu Servers) and I used tomcat supported clustering technique with mod_jk following the link which is clear and easy to follow.
I did this in my LAN with three computers 1 as LB and other two as tomcat web servers and I thought of implementing this for production once I'm completely satisfied with the setup.
I followed many links and the link I pasted is the one of them and I configured it on different physical machine. The configuration is successful and I felt it's very easy to set it up. I checked stopping one tomcat webserver and it immediate started sending request to the other webserver. As far as I know I am clear that this configuration supports both HA & LB.
Below are my apache tomcat clustering details:
1 Load Balancer(192.168.1.100)
2 web Servers(192.168.1.101, 192.168.1.102)
On all the three servers, I installed apache2 & tomcat6 and configured tomcat to run on port 80 with mod_jk on all the servers.
Load Balancer:
Configured apache2 and tomcat with mod_jk setup(both are running on port 80)
As per the link I setup workers.properties with same default ports(as I'm using different machines)
Web Servers:
Let Actual site: www.mydomain.com which is pointing to LB
Configured apache2 and tomcat with mod_jk setup(both are running on port 80)
I can access web application by pointing the browser to following:
http://192.168.1.101/myapp
http://192.168.1.102/myapp
In either of the web servers I configured tomcat virtual hosting with actual site name(www.mydomain.com) as Host Name
I have an issue with tomcat jsp application. On any web server, if myapp directory is removed from webapps, the load balancer still redirects to that web server and the user have to face 404 error page which neither apache nor tomcat identifies and redirects to other available web servers.
Anybody has any technique so that client requests are redirected to other web servers in cluster when the requested application(myapps) in webapps is not available on a web server?
Thank you!
Update:1
Trying the below worker directive in the workers.properties of load balancer. Now the 404 error page is not displayed when myapp in webapps is removed but showing 503 error(this generally shown when tomcat is stopped). But still could not redirect to other available server when myapps is removed.
worker.<worker-name-here>.fail_on_status=-404,-500,503