How to cluster Tomcat servers

Home > Search > How-to
  by

A cluster is two or more servers that provide the same services. For example, a cluster may have two Tomcat application servers. If one of the Tomcat server fails, the other server in the cluster can continue to serve web requests.

 

On both Tomcat servers, add <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster" /> to the <Engine> or <Host> container in your $CATALINA_HOME/conf/server.xml file.

<Engine name="Catalina" defaultHost="localhost">
  <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster" />
   . . .

 

To test this, shutdown server 1 and ensure server 2 continues to serve requests.

[john.doe@server1 ~]# $CATALINA_HOME/bin/shutdown.sh

 

Use the Tomcat manual for more details on clustering.



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter in the box below so that we can be sure you are a human.




Comments