You set up a cluster for WSO2 App Manager and create a distributed deployment of its four main components: Publisher, Store, Gateway, and Identity Provider. This page describes how to set up the distributed deployment in the following sections.
...
App Manager uses four main components. They are Publisher, Store, Gateway, and IDP. Additionally, App Manager uses four databases. The following databases are shared among the server nodes.
User Manager Database(UM_DB) - Stores information related to users and user roles. This information is shared among the IDP Server, Store, Publisher, and Gateway.
APP Manager Database(AM_DB) - Stores information related to the apps along with the app subscription details.
Registry Database(REG_DB) - Shares information between the Publisher, Store, and Gateway.
ES Storage Database(ES_STORAGE_DB) - Shares resources (images, etc.) between the Publisher and Store.
...
- Download the latest versions of WSO2 App Manager in each of the servers in the cluster for distributed deployment.
- Unzip the App Manager zipped archive, and rename each of those directories respectively as IDP, Gateway, Publisher, and Store. These four directories are located placed in a server of their own and will be used for each component of the API App Manager. Each of these unzipped directories will be referred to as
<APPM_HOME>
or<PRODUCT_HOME>
in this document.
...
Download and install MySQL Server.
Download the MySQL JDBC driver.
Unzip the downloaded MySQL driver zipped archive, and copy the MySQL JDBC driver JAR (
mysql-connector-java-x.x.xx-bin.jar
) into the<PRODUCT_HOME>/repository/components/lib
directory of all the nodes in the cluster.- Define the host name hostname for configuring permissions for the new database by opening the
/etc/hosts
file and adding the following line:<MYSQL-DB-SERVER-IP> carbondb.mysql-wso2.com
Info You would do this step only if your database is not on your local machine and on a separate server.
- Enter the following command in a terminal/command window, where
username
is the username you want to use to access the databases:mysql -u username -p
- When prompted, specify the password that will be used to access the databases with the username you specified.
Only four databases are used as shared MySQL databases, the rest of the data is stored in the internal H2 database that is shipped with the product. Create the four databases using the following commands. The
username
andpassword
are the same as those you specified in the previous steps.Code Block language none mysql> create database AM_DB; mysql> use AM_DB; mysql> source <APPM_HOME>/dbscripts/appmgt/mysql.sql; mysql> source <APPM_HOME>/dbscripts/identity/mysql.sql; mysql> grant all on AM_DB.* TO username@localhost identified by "password"; mysql> create database UM_DB; mysql> use UM_DB; mysql> source <APPM_HOME>/dbscripts/mysql.sql; mysql> grant all on UM_DB.* TO username@localhost identified by "password"; mysql> create database REG_DB; mysql> use REG_DB; mysql> source <APPM_HOME>/dbscripts/mysql.sql; mysql> grant all on REG_DB.* TO username@localhost identified by "password"; mysql> create database ES_STORAGE_DB; mysql> use ES_STORAGE_DB; mysql> source <APPM_HOME>/dbscripts/storage/mysql/resource.sql; mysql> grant all on ES_STORAGE_DB.* TO username@localhost identified by "password";
Note Ensure that MySQL is configured so that all nodes can connect to it.
Configure the datasources for the four databases as follows:
Open the
<APPM_HOME>/repository/conf/datasources/master-datasources.xml
file in all four App Manager nodes.Enable the components to access the App Manager database by modifying the WSO2AM_DB datasource in all four
master-datasources.xml
files as follows:Code Block language xml <datasource> <name>WSO2AM_DB</name> <description>The datasource used for the API Manager database</description> <jndiConfig> <name>jdbc/WSO2AM_DB</name> </jndiConfig> <definition type="RDBMS"> <configuration> <url>jdbc:mysql://apimgtdb.mysql-wso2.com:3306/apimgtdb?autoReconnect=true</url> <username>user</username> <password>password</password> <defaultAutoCommit>false</defaultAutoCommit> <driverClassName>com.mysql.jdbc.Driver</driverClassName> <maxActive>50</maxActive> <maxWait>60000</maxWait> <testOnBorrow>true</testOnBorrow> <validationQuery>SELECT 1</validationQuery> <validationInterval>30000</validationInterval> </configuration> </definition> </datasource>
Enable all components to access the user's database by configuring the WSO2UM_DB datasource in their
master-datasources.xml
files as follows:Code Block language xml <datasource> <name>WSO2UM_DB</name> <description>The datasource used by user manager</description> <jndiConfig> <name>jdbc/WSO2UM_DB</name> </jndiConfig> <definition type="RDBMS"> <configuration> <url>jdbc:mysql://userdb.mysql-wso2.com:3306/userdb?autoReconnect=true</url> <username>user</username> <password>password</password> <driverClassName>com.mysql.jdbc.Driver</driverClassName> <maxActive>50</maxActive> <maxWait>60000</maxWait> <testOnBorrow>true</testOnBorrow> <validationQuery>SELECT 1</validationQuery> <validationInterval>30000</validationInterval> </configuration> </definition> </datasource>
Enable the Publisher and Store components to access the registry database by configuring the WSO2REG_DB data source in their
master-datasources.xml
files as follows:Code Block language xml <datasource> <name>WSO2REG_DB</name> <description>The datasource used by the registry</description> <jndiConfig> <name>jdbc/WSO2REG_DB</name> </jndiConfig> <definition type="RDBMS"> <configuration> <url>jdbc:mysql://regdb.mysql-wso2.com:3306/regdb?autoReconnect=true</url> <username>user</username> <password>password</password> <driverClassName>com.mysql.jdbc.Driver</driverClassName> <maxActive>50</maxActive> <maxWait>60000</maxWait> <testOnBorrow>true</testOnBorrow> <validationQuery>SELECT 1</validationQuery> <validationInterval>30000</validationInterval> </configuration> </definition> </datasource>
Enable the Publisher and Store components to access the storage database by configuring the ES_Storage datasource in their
master-datasources.xml
files as follows:Code Block language xml <datasource> <name>JAGH2</name> <description>The datasource used for by the Jaggery Storage Manager</description> <jndiConfig> <name>jdbc/ES_Storage</name> </jndiConfig> <definition type="RDBMS"> <configuration> <url>jdbc:mysql://mysql-appm.wso2.com:3306/ES_STORAGE_DB?autoReconnect=true</url> <username>user</username> <password>password</password> <driverClassName>com.mysql.jdbc.Driver</driverClassName> <maxActive>50</maxActive> <maxWait>60000</maxWait> <testOnBorrow>true</testOnBorrow> <validationQuery>SELECT 1</validationQuery> <validationInterval>30000</validationInterval> </configuration> </definition> </datasource>
To give the Gateway, Publisher, and Store components access to the App Manager database, open the
<APPM_HOME>/repository/conf/apiapp-manager.xml
file in each of the components and add the following line as the first child node of the root element (if it is not already there):<DataSourceName>
jdbc/WSO2AM_DB</DataSourceName>
<UiActivityPublishDataSourceName>jdbc/WSO2AM_DB</UiActivityPublishDataSourceName>To give all the components access to the user's database with shared permissions, open the
<APPM _HOME>/repository/conf/user-mgt.xml
file in each of these nodes and add or modify thedataSource
property of the<configuration>
element as follows:Code Block language none <configuration> ... <Property name="dataSource">jdbc/WSO2UM_DB</Property> </configuration> <UserStoreManager class="org.wso2.carbon.user.core.jdbc.JDBCUserStoreManager"> <Property name="TenantManager">org.wso2.carbon.user.core.tenant.JDBCTenantManager</Property> <Property name="ReadOnly">false</Property> <Property name="MaxUserNameListLength">100</Property> <Property name="IsEmailUserName">false</Property> <Property name="DomainCalculation">default</Property> <Property name="PasswordDigest">SHA-256</Property> <Property name="StoreSaltedPassword">true</Property> <Property name="ReadGroups">true</Property> <Property name="WriteGroups">true</Property> <Property name="UserNameUniqueAcrossTenants">false</Property> <Property name="PasswordJavaRegEx">^[\S]{5,30}$</Property> <Property name="PasswordJavaScriptRegEx">^[\S]{5,30}$</Property> <Property name="UsernameJavaRegEx">^[^~!#$;%^*+={}\\|\\\\<>,\'\"]{3,30}$</Property> <Property name="UsernameJavaScriptRegEx">^[\S]{3,30}$</Property> <Property name="RolenameJavaRegEx">^[^~!#$;%^*+={}\\|\\\\<>,\'\"]{3,30}$</Property> <Property name="RolenameJavaScriptRegEx">^[\S]{3,30}$</Property> <Property name="UserRolesCacheEnabled">true</Property> <Property name="MaxRoleNameListLength">100</Property> <Property name="MaxUserNameListLength">100</Property> <Property name="SharedGroupEnabled">false</Property> <Property name="SCIMEnabled">false</Property> </UserStoreManager>
To give the Publisher and Store components access to the registry database, open the
<APPM_HOME>/repository/conf/registry.xml
file in each of these two components and configure them as follows:Note Note: Do not replace the following configuration when adding in the mounting configurations. The registry mounting configurations mentioned in the below steps must be added in addition to the following.
Code Block <dbConfig name="wso2registry"> <dataSource>jdbc/WSO2CarbonDB</dataSource> </dbConfig>
In the Publisher component's
registry.xml
file, add or modify thedataSource
attribute of the<dbConfig name="govregistry">
element as follows:Code Block language none <dbConfig name="govregistry"> <dataSource>jdbc/WSO2REG_DB</dataSource> </dbConfig> <remoteInstance url="https://publisher.appm-wso2.com"> <id>gov</id> <cacheId>user@jdbc:mysql://regdb.mysql-wso2.com:3306/regdb</cacheId> <dbConfig>govregistry</dbConfig> <readOnly>false</readOnly> <enableCache>true</enableCache> <registryRoot>/</registryRoot> </remoteInstance> <mount path="/_system/governance" overwrite="true"> <instanceId>gov</instanceId> <targetPath>/_system/governance</targetPath> </mount> <mount path="/_system/config" overwrite="true"> <instanceId>gov</instanceId> <targetPath>/_system/config</targetPath> </mount>
In the Store component's
registry.xml
file, add or modify thedataSource
attribute of the<dbConfig name="govregistry">
element as follows (note that this configuration is nearly identical to the previous step with the exception of theremoteInstance
URL):Code Block language none <dbConfig name="govregistry"> <dataSource>jdbc/WSO2REG_DB</dataSource> </dbConfig> <remoteInstance url="https://store.appm-wso2.com"> <id>gov</id> <cacheId>user@jdbc:mysql://regdb.mysql-wso2.com:3306/regdb</cacheId> <dbConfig>govregistry</dbConfig> <readOnly>false</readOnly> <enableCache>true</enableCache> <registryRoot>/</registryRoot> </remoteInstance> <mount path="/_system/governance" overwrite="true"> <instanceId>gov</instanceId> <targetPath>/_system/governance</targetPath> </mount> <mount path="/_system/config" overwrite="true"> <instanceId>gov</instanceId> <targetPath>/_system/config</targetPath> </mount>
Modify the /etc/hosts entries to map the relevant IP addresses to the remoteInstance URLs.
127.0.0.1 publisher.appm-wso2.com
127.0.0.1 store.appm-wso2.com
Once registry caching is enabled, sync the published apps between the Publisher and Store nodes by enabling clustering in both Store and Publisher nodes. To do this, open the
<APIM<APPM_HOME>/repository/conf/axis2/axis2.xml
file in each of these two components and configure them as follows:<clustering class="org.wso2.carbon.core.clustering.hazelcast.HazelcastClusteringAgent" enable="true">
...
A Gateway node must be up and running for you to create apps through the Publisher.
Follow the steps below to configure the Publisher and Store to be in a single cluster domain. You need to configure both nodes as instructed below
Open the
<APPM_HOME>/repository/conf/axis2/axis2.xml
file and scroll down to the 'Clustering' section.Set the 'enable' attribute of the
<clustering>
element totrue
.Code Block <clustering class="org.wso2.carbon.core.clustering.hazelcast.HazelcastClusteringAgent" enable="true">
Change the '
membershipScheme
' parameter to 'wka
'.Code Block <parameter name="membershipScheme">wka</parameter>
Provide a domain for the cluster.
Code Block <parameter name="domain">wso2.pub.store.domain</parameter>
Specify the 'localMemberHost' and 'localMemberPort' parameters. If on the publisher, the 'localMemberHost' should be the publisher's IP address. The port value should be the port on which the Publisher will be listening for incoming cluster messages. Same applies to the Store.
Code Block <parameter name="localMemberHost">192.168.10.1</parameter> <parameter name="localMemberPort">4000</parameter>
Specify well-known member. When specifying the well-known member, the Publisher should specify the Store information and the Store should specify the Publisher information. The port provided here should be equal to the '
localMemberPort
' of the other member.Code Block <members> <member> <hostName>192.168.10.2</hostName> <port>4000</port> </member> </members>
- Save and close the files and restart the servers (if running) for the changes to take effect.
...