Uncategorized 2 min

WSO2TORIAL: Clustering WSO2 API with ClustrixDB

Philip Akyempon
Philip Akyempon
Integration Specialist
ClustrixDB and API Manager


WSO2 API Manager is a complete API management solution, used for creating and publishing APIs, creating and managing a developer community, and routing API traffic. The API Manager solution includes a Publisher, Store, Gateway, and Key Manager component.

ClustrixDB is a drop-in replacement for MySQL and an ideal solution for high-transaction, high-value workloads typically found in industries such as ad tech, e-commerce, gaming and large web and mobile businesses.

ClustrixDB and WSO2 API Manager

In order to verify the syntactical similarity between ClustrixDB – and MySQL commands, we have two instances of a WSO2 APIM running in a cluster and supported by ClustrixDB deployed onto three Amazon EC2 nodes as shown in the diagram below.

ClustrixDB and API Manager.png

Installing ClustrixDB

The requirements of ClustrixDB cluster setup recommends three nodes with a minimum of a 4 cores processor and 7.5GB RAM on each for development or test.  Upon gaining access to a node, the installation process can start by obtaining a copy of ClusterixDB using curl. Example:

$curl http://files.clustrix.com/releases/getclustrixdb | sh

Follow the on-screen wizard and the instructions provided here to install ClustrixDB

Configuring WSO2 APIM

After ClusterixDB installation, the shared databases for the two instances of APIM can be created using MySQL syntax as shown below.

$mysql -u root;
$create database userstore;
$create database registry;
$create database apimgt;
$GRANT ALL ON apimgt.* TO apiuser@localhost identified by “apimanager”;
$GRANT ALL ON userstore.* TO apiuser@localhost identified by “apimanager”;
$GRANT ALL ON registry.* TO apiuser@localhost identified by “apimanager”;

Once the databases for the cluster are setup, the master-datasources.xml file for both instances of WSO2 APIM should be edited to reflect the changes. WSO2AM_DB datasource will point to the apimgt database, WSO2REG_DB datasource to registry database and WSO2UM_DB to userstore database. The user-mgt.xml and registry.xml configuration files need to be updated as well with user-store and registry information respectively.

At the stage of the setup, where the databases need to be populated either my importing the creation scripts for MySQL or starting an instance of the API server with -Dsetup command, note should be taking to remove any unsupported collations and all the HASHing commands in the mysql.sql script.

As explained here, even though ClustrixDB is a drop-in for MySql, there are some differences. ClustrixDB most closely emulates the interface of the InnoDB storage engine and support most of the standard MySQL functionalities. Supported DDL and SQL can be found here.


The demonstrated setup shows that ClustrixDB is syntactically similar to MySQL and indeed WSO2 API datasource configurations can just as easily be implemented on ClustrixDB.

Read also our other WSO2 tutorials and blogs, written by our WSO2 Gurus. In case you need WSO2 support, contact the Yenlo WSO2 Guru team to get WSO2 Development Support or WSO2 Operational Support. Of course we do deliver excellent WSO2 training services as well, based on reallife WSO2 tutorials.

Full API lifecycle Management Selection Guide

whitepaper hero
Get it now
We appreciate it
Care to share

Please select one of the social media platforms below to share this pages content with the world