In eXo Platform 4.0.x, cluster mode is supported for JBoss only. This guideline is not usable for Tomcat.
Setting up eXo Platform clustering
Install your Platform JBoss package by following steps in Installing JBoss EAP.
Create a copy of the package for each cluster node. It is assumed that you have 2 available hosts: node1.your-domain.com (here node1 will be executed) and node2.your-domain.com (here node2 will be executed). You need to place a copy of the package in node1, and another copy in node2.
Configure both packages to use the same database by following instructions in the Database chapter.
According to instructions in Database, you will need to edit the standalone-exo.xml
file.
However, in the cluster mode, you should edit standalone-exo-cluster.xml
or any file that you set in the start command:
--server-config=standalone-exo-cluster.xml.
Share a folder on the network that can be accessed from 2 nodes (depending on your operating system).
Assuming that the folder's path is: /mnt/nfs/shared/data
, edit the system property
exo.shared.dir
in the standalone-exo-cluster.xml
file:
<system-properties>
...
<property name="exo.shared.dir" value="/mnt/nfs/shared/data"/>
...
</system-properties>
Edit the $PLATFORM_JBOSS_HOME/bin/standalone-customize.conf
file by adding the following line:
In node1:
JAVA_OPTS="${JAVA_OPTS} -Djgroups.tcpping.initial_hosts=node1.your-domain.com[7800],node2.your-domain.com[7800] -Djgroups.tcpping.num_initial_members=2 -Djboss.node.name=node1"
In node2:
JAVA_OPTS="${JAVA_OPTS} -Djgroups.tcpping.initial_hosts=node1.your-domain.com[7800],node2.your-domain.com[7800] -Djgroups.tcpping.num_initial_members=2 -Djboss.node.name=node2"
The -Djgroups.tcpping.initial_hosts parameter is a comma-separated list of nodes.
Each node should be represented by its FQDN (or IP) and a port.
The port must match the TCP start_port that is configured in the
standalone/configuration/gatein/jgroups/jgroups-tcp.xml
file:
<TCP
...
start_port="${jgroups.tcp.start_port:7800}"
... />
You can either edit the 7800 value directly or set the system property jgroups.tcp.start_port (via start command or
the server configuration file - standalone-exo-cluster.xml
as explained before).
Run the servers:
Start node1 from its $PLATFORM_JBOSS_HOME/bin
directory:
Start node2 from its $PLATFORM_JBOSS_HOME/bin
by the same command:
The command is used on Linux. On Windows, just replace standalone.sh with standalone.bat.
Some additional notes
It is possible to set up the nodes in the same machine for studying and testing purposes. In this case, you need to avoid port and node name conflicts by using the following start commands:
For node1:
./standalone.sh -Djboss.node.name=node1 --server-config=standalone-exo-cluster.xmlFor node2:
./standalone.sh -Djboss.node.name=node2 --server-config=standalone-exo-cluster.xml -Djboss.socket.binding.port-offset=100The first parameter will set the jboss.node.name property to node1 and node2 respectively. If this parameter is not set, the node name is automatically set to the machine hostname that causes a name conflict.
The third parameter (in the start command of node2) will activate the port-offset of 100. The obvious influence of that option is that if, for example, the port for the management-console is configured to 9990, it will really be available on the port: 9990+100=10090. Then this parameter prevents port conflicts with node1.
If you want to use other IP socket bindings instead of port-offset, make sure to use the same multicast group.
If you configure nodes using IP, the -Djgroups.bind_addr=192.168.x.x parameter is needed. For example, if node1 is 192.168.210.101 and node2 is 192.168.210.102, the JVM_OPTS configuration will be:
For node1:
JAVA_OPTS="${JAVA_OPTS} -Djgroups.tcpping.initial_hosts=192.168.210.101[7800],192.168.210.102[7800] -Djgroups.tcpping.num_initial_members=2 -Djboss.node.name=node1 -Djgroups.bind_addr=192.168.210.101"
For node2:
JAVA_OPTS="${JAVA_OPTS} -Djgroups.tcpping.initial_hosts=192.168.210.101[7800],192.168.210.102[7800] -Djgroups.tcpping.num_initial_members=2 -Djboss.node.name=node2 -Djgroups.bind_addr=192.168.210.102"
The default used configuration for JGroups is TCP's. You may use UDP alternatively. The 2 configuration files are:
$PLATFORM_JBOSS_HOME/standalone/configuration/gatein/jgroups/jgroups-tcp.xml
$PLATFORM_JBOSS_HOME/standalone/configuration/gatein/jgroups/jgroups-udp.xml
To use UDP, edit the $PLATFORM_JBOSS_HOME/standalone/configuration/gatein/configuration.properties
file by replacing this line:
gatein.jgroups.config=${gatein.conf.dir}/jgroups/jgroups-tcp.xml
with:
gatein.jgroups.config=${gatein.conf.dir}/jgroups/jgroups-udp.xml
After completing the steps above, you can access the application via host name / ip address of each node:
To configure a front-end for your nodes, follow Setting up Apache front-end.
To configure load balancing, follow Setting up mod_jk.
See also