I am looking into high availability for tomcat.
I read that you can do cluster in Tomcat and as load balancer you can use Apache http.
I can not understand the following:
Is Apache http that is supposed to be the module for load balancing supposed to be installed on a separate machine than Tomcat server?
E.g. If I have 3 tomcat servers to be a cluster, is http supposed to be installed in all 3? Or in an other server?
Also what is the difference if I used Linux facilities for high availability?
I am looking into high availability for tomcat. I read that you can do
Share
To have HA, the users need to always have a response from the DNS name / IP Address they make a request to.
There are multiple ways to achieve this, and some are not even mutually exclusive.
The first tool in the box, so to say, is DNS round robin.
This is where your DNS entry does not have a single IP address, but a list of IP addresses. Each query of your DNS record will return the list in a different order. Client browsers that are DNS round robin aware will try the first entry and fall back to the others in order. Client browsers that are not DNS round robin aware will only try the first entry. That acts as a sort of load balancer… and for the DNS round robin aware client applications, you get a form of automatic fail-over.
The next tool in the box is a load balancer, such as Apache HTTPD or Nginix. These act as the front end that the client sees. They are state aware (hopefully you configure them to be), so they know which of your Tomcat servers are up and which are down, and they route the client requests to servers that have capacity and are up.
So if you want HA. You start by clustering your Tomcat servers… That will most likely require a session store for the cluster… so you use a DB to hold the session store… then you cluster that DB in case of failover… then your but a load balancer in front of the Tomcat instances… then you add a second load balancer in case of a failure in the load balancer… then you use DNS round robin to balance between the load balancers…
You might use ARP broadcast IP address take-over to quickly replace the load balancers in place of, or in addition to DNS round robin…
Then you start to think about geo-redundancy… so you go to the pharmacy and buy a bottle of aspirin!
Before I forget, there is nothing that says you can’t do this all on the same hardware… just you run the risk of processes stealing CPU/memory/disk and also the risk of a hardware failure.
The most basic resilient HA that you can get is two machines, both running the DB cluster, both running the Tomcat cluster, both running the Load Balancer, and both configured as DNS round-robin entries for the DNS name of the application