This documentation is for WSO2 Private PaaS 4.1.0. View documentation for the latest release.
Page Comparison - Configuring PPaaS with External Databases (v.12 vs v.13) - WSO2 Private PaaS 4.1.0 - WSO2 Documentation

Versions Compared

Key

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

...

  1. Copy the MySQL JDBC driver to the <PRIVATE_PAAS_HOME>/repository/components/lib directory.

  2. Create 3 empty databases, in the <PRIVATE_PAAS_HOME>/dbscripts directory, in your MySQL server with the following names and grant permission to the databases, so that they can be accessed through a remote server.

    ppaas_registry_db
    ppaas_user_db
    ppaas_config_db
     

  3. Navigate to the <PRIVATE_PAAS_HOME>/repository/conf/datasources directory and add the datasources that correspond to your DB in the master-datasources.xml file.
    Change the IP addresses and ports based on your environment.

    Code Block
    <datasource>
        <name>WSO2_GOVERNANCE_DB</name>
        <description>The datasource used for governance MySQL database</description>
        <jndiConfig>
            <name>jdbc/registry</name>
        </jndiConfig>
        <definition type="RDBMS">
            <configuration>
                <url>jdbc:mysql://[MYSQL_HOSTNAME]:[MYSQL_PORT]/ppaas_registry_db?autoReconnect=true</url>
                <username>[USERNAME]</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>
     <datasource>
        <name>WSO2_CONFIG_DB</name>
        <description>The datasource used for CONFIG MySQL database</description>
        <jndiConfig>
            <name>jdbc/ppaas_config</name>
        </jndiConfig>
        <definition type="RDBMS">
            <configuration>
                <url>jdbc:mysql://[MYSQL_HOSTNAME]:[MYSQL_PORT]/ppaas_config_db?autoReconnect=true</url>
                <username>[USERNAME]</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>
     <datasource>
        <name>WSO2_USER_DB</name>
        <description>The datasource used for userstore MySQL database</description>
        <jndiConfig>
            <name>jdbc/userstore</name>
        </jndiConfig>
        <definition type="RDBMS">
            <configuration>
                <url>jdbc:mysql://[MYSQL_HOSTNAME]:[MYSQL_PORT]/ppaas_user_db?autoReconnect=true</url>
                <username>[USERNAME]</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. Navigate to the <PRIVATE_PAAS_HOME>/repository/conf directory and change the datasources in both the user-mgt.xml and identity.xml files as follows: 

    Code Block
    <Property name="dataSource">jdbc/userstore</Property>
  5. Navigate to the <PRIVATE_PAAS_HOME>/repository/conf directory and add the following configurations in the registry.xml file. Change your IP addresses and ports based on your environment.

    Code Block
    <dbConfig name="governance">
        <dataSource>jdbc/registry</dataSource>
    </dbConfig>
    <remoteInstance url="https://localhost:9443/registry">
        <id>governance</id>
        <dbConfig>governance</dbConfig>
        <readOnly>false</readOnly>
        <registryRoot>/</registryRoot>
        <enableCache>true</enableCache>
        <cacheId>root@jdbc:mysql://52.88.160.106:3306[MYSQL_HOSTNAME]:[MYSQL_PORT]/ppaas_registry_db</cacheId>
    </remoteInstance>
    <dbConfig name="config">
        <dataSource>jdbc/ppaas_config</dataSource>
    </dbConfig>
    <remoteInstance url="https://localhost:9443/registry">
        <id>config</id>
        <dbConfig>config</dbConfig>
        <readOnly>false</readOnly>
        <registryRoot>/</registryRoot>
        <enableCache>true</enableCache>
        <cacheId>root@jdbc:mysql://52.88.160.106:3306[MYSQL_HOSTNAME]:[MYSQL_PORT]/ppaas_config_db</cacheId>
    </remoteInstance>
    <mount path="/_system/governance" overwrite="true">
        <instanceId>governance</instanceId>
        <targetPath>/_system/governance</targetPath>
    </mount>
    <mount path="/_system/config" overwrite="true">
        <instanceId>config</instanceId>
        <targetPath>/_system/config</targetPath>
    </mount>