This documentation is for older versions of WSO2 products and may not be relevant now. Please see your respective product documentation for clustering details and configurations.

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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.

...

  1. Download the latest versions of WSO2 App Manager in each of the servers in the cluster for distributed deployment.
  2. 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.

...

  1. Download and install MySQL Server.

  2. Download the MySQL JDBC driver.

  3. 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.

  4. 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.

  5. 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
  6. When prompted, specify the password that will be used to access the databases with the username you specified.
  7. 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 and password are the same as those you specified in the previous steps.

    Code Block
    languagenone
    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 [email protected] 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 [email protected] 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 [email protected] 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 [email protected] identified by "password"; 
    Note

    Ensure that MySQL is configured so that all nodes can connect to it.

  8. Configure the datasources for the four databases as follows:

    1. Open the <APPM_HOME>/repository/conf/datasources/master-datasources.xml file in all four App Manager nodes.

    2. 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
      languagexml
      <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>
    3. 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
      languagexml
      <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> 
    4. 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
      languagexml
      <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> 
    5. 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
      languagexml
      <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>
  9. 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> 

  10. 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 the dataSource property of the <configuration> element as follows:

    Code Block
    languagenone
    <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">^[^~!#$;%^*+={}\\|\\\\&lt;&gt;,\'\"]{3,30}$</Property>
        <Property name="UsernameJavaScriptRegEx">^[\S]{3,30}$</Property>
        <Property name="RolenameJavaRegEx">^[^~!#$;%^*+={}\\|\\\\&lt;&gt;,\'\"]{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>
  11. 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>
    1. In the Publisher component's registry.xml file, add or modify the dataSource attribute of the <dbConfig name="govregistry"> element as follows:

      Code Block
      languagenone
      <dbConfig name="govregistry">
        <dataSource>jdbc/WSO2REG_DB</dataSource>
      </dbConfig>
      <remoteInstance url="https://publisher.appm-wso2.com"> 
         <id>gov</id>
         <cacheId>[email protected]: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>
    2. In the Store component's registry.xml file, add or modify the dataSource attribute of the <dbConfig name="govregistry"> element as follows (note that this configuration is nearly identical to the previous step with the exception of the remoteInstance URL):

      Code Block
      languagenone
      <dbConfig name="govregistry">
        <dataSource>jdbc/WSO2REG_DB</dataSource>
      </dbConfig>
      <remoteInstance url="https://store.appm-wso2.com"> 
         <id>gov</id>
         <cacheId>[email protected]: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>
    3. 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

  12. 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">

...