Configuring PPaaS with External Databases
Follow the instructions given below to configure PPaaS with external databases:
WSO2 Private PaaS 4.1.0 requires the following external databases: User database, Governance database and Config database. Therefore, before using the above databases, you need to create these DBs, as explained in Working with Databases, and configure Private PaaS as mentioned below.
Copy the MySQL JDBC driver to the
<PRIVATE_PAAS_HOME>/repository/components/lib
directory.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
Navigate to the
<PRIVATE_PAAS_HOME>/repository/conf/datasources
directory and add the datasources that correspond to your DB in themaster-datasources.xml
file.
Change the IP addresses and ports based on your environment.<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>
Navigate to the
<PRIVATE_PAAS_HOME>/repository/conf
directory and change the datasources in both theuser-mgt.xml
andidentity.xml
files as follows:<Property name="dataSource">jdbc/userstore</Property>
Navigate to the
<PRIVATE_PAAS_HOME>/repository/conf
directory and add the following configurations in theregistry.xml
file. Change your IP addresses and ports based on your environment.<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://[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://[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>