Enabling Axis2 clustering is a simple task. Let us look at setting up a simple two node cluster:
Extract the Axis2 distribution into two different directories and change the HTTP and HTTPS ports in the respective
axis2.xml
files.Locate the "Clustering" element in the
axis2.xml
files and set theenable
attribute totrue
. Start the two Axis2 instances using Simple Axis Server. You should see some messages indicating that clustering has been enabled. That is it! Wasn't that extremely simple?In order to verify that state replication is working, we can deploy a stateful web service on both instances. This web service should set a value in the
ConfigurationContext
in one operation and try to retrieve that value in another operation. We can call the set value operation on one node, and next call the retrieve operation on the other node. The value set and the value retrieved should be equal.
Next, we will look at the clustering configuration language in detail.