Permalink to this page:

How to use Tomcat clustering in the cloud.

The load-balancer and the sticky (or not sticky) logic is provided by the cloud itself, basically you have to expose a service and configure a route. Cloud configuration depends on the cloud providers, documentation for more cloud providers will be added to this wiki.

The Tomcat clustering for the cloud uses Kubernetes, so you have to configure your nodes to use Kubernetes, all cloud providers support Kubernetes. Kubernetes uses Docker so you have to create a Docker image to use Tomcat in the cloud. There are 2 ways to organize your images: use a standalone Tomcat and add your webapps to it or prepare your webapps as a micro service and have one image per webapp. Each image will be started as a pod on Kubernetes, you can scale up and down by changing the number of pods running your webapp or your Tomcat. Hanging or dying pods are restarted by Kubernetes.

1 - "Full" tomcat configuration:

In server.xml use the following:

<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster">
<Channel className="">
<Membership className=""/>

2 - Example:

There is an example to use it with OpenShift in