Hey there!

On my last post Are there different types of clusters? we saw two different types of clusters: Dynamic Discovery and Static Discovery. To see details, see the post! 😉

Now let’s see quickly how we can set them up at the Apache TomEE. One of the types – the Dynamic – we have already seen in the post How to build an Apache TomEE cluster. So we will do just a little zoom to see where the things are done.

Dynamic Discovery

At the “Engine” node you should put this code (see the post mentioned above for detailed code):

<Cluster

className=”org.apache.catalina.ha.tcp.SimpleTcpCluster”

channelSendOptions=”6″>

<Manager…

<Channel…

<Valve…

<Deployer…

<ClusterListener…

</Cluster>

Static Discovery

At the same “Engine” node you should put this:

<Cluster className=”org.apache.catalina.ha.tcp.SimpleTcpCluster”channelSendOptions=”6″>

<Channel className=”org.apache.catalina.tribes.group.GroupChannel”>

<Interceptor className=”org.apache.catalina.tribes.group.interceptors.StaticMembershipInterceptor”>

<Member className=”org.apache.catalina.tribes.membership.StaticMember” port=”4000″ host=”server1″ uniqueId=”{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}” />

<Member className=”org.apache.catalina.tribes.membership.StaticMember” port=”4000″ host=”server2″ uniqueId=”{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}” />

<Member className=”org.apache.catalina.tribes.membership.StaticMember” port=”4000″ host=”server3″ uniqueId=”{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}” />

</Interceptor>

</Channel>

</Cluster>

So as you can see, with the Static Discovery you use the StaticMember at the Member node instead of McastService used at the Dynamic Discovery. To see the functional differences between them see my last post Are there different types of clusters?.

Hope you enjoy building your own TomEE cluster! If you have any particular experience to share, please leave it at the comments bellow. See you!