It is possible to install multiple instances of WSO2 products in a cluster to ensure that if one instance becomes unavailable or is experiencing high traffic, another instance will seamlessly handle the requests.A cluster consists of multiple instances of a product that act as if they are a single instance and divide up the work.
WSO2 provides Hazelcast Community Edition as its default clustering engine.
For this setup I have use two WSO2 MB nodes with a mysql database. For this sample setup I have use the same server for both MB nodes and database. So host configurations needs to be changed on a real environment.
NOTE: I will be using Node 1 with default ports and Node 2 with a port offset of 3 as I'm running the both instances in the same server. So first change the port offset of the 2nd MB instance by changing the following property in carbon.xml file
Creating and sharing the Database
Create following four databases.
- WSO2_USER_DB - JDBC user store and authorization manager
- REGISTRY_DB - Shared database for config and governance registry mounts in the product's nodes
- REGISTRY_LOCAL1 - Local registry space in the manager node
- REGISTRY_LOCAL2 - Local registry space in the worker node
Enable Hazelcast clustering
Update the host name with the correct IP value of this node.
Add the details of the other members. In my case it is the other mb node which runs with offset of 3 in the same server.
Uncomment and add the IP address of the machine hosting this server for host name and carbon management console host name.
Comment the datasource with the name "WSO2_CARBON_DB"
Add the following three datasources.
Add details of the shared registry
Change the datasource to
localMemberPort should be offset by 3 as follows.
The members should be updated correctly
Instead of REGISTRY_LOCAL1 , the details of REGISTRY_LOCAL2 should be added as follows.
Required port offset is added as described earlier.
Once you have configured the broker nodes and the DBMS for storage, you can start up the Message Broker cluster. Start one MB node and wait until the startup completed. You must wait until the Management Console URL appears on your command line and then start the other node.