You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

How to use tomcat clustering in the cloud.

The load-balancer and the sticky (or not sticky) logic is provided by the cloud it self, basically you have to expose a service and configure a route. Cloud configuration depends on the cloud providers, document for the mean cloud providers will be added to this wiki. The tomcat clustering for the cloud uses Kubernetes 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 webapps. 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="org.apache.catalina.tribes.group.GroupChannel">
<Membership className="org.apache.catalina.tribes.membership.cloud.CloudMembershipService"/>
</Channel>
</Cluster>

2 - Example there is an example to use it with OpenShift in https://github.com/jfclere/tomcat-kubernetes

  • No labels