Versions Compared

Key

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

...

  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 both the manager and worker nodes.

  4. Define the host name 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. Create the databases using the following commands, where <PRODUCT_HOME> is the path to any of the product instances you installed, and username and password are the same as those you specified in the previous steps:

    Code Block
    languagenone
    mysql> create database WSO2_USER_DB;
    mysql> use WSO2_USER_DB;
    mysql> source <PRODUCT_HOME>/dbscripts/mysql.sql;
    mysql> grant all on WSO2_USER_DB.* TO regadmin@carbondbregadmin@"carbondb.mysql-wso2.com" identified by "regadmin";
    
    mysql> create database REGISTRY_DB;
    mysql> use REGISTRY_DB;
    mysql> source <PRODUCT_HOME>/dbscripts/mysql.sql;
    mysql> grant all on REGISTRY_DB.* TO regadmin@carbondbregadmin@"carbondb.mysql-wso2.com" identified by "regadmin";
    
    mysql> create database REGISTRY_LOCAL1;
    mysql> use REGISTRY_LOCAL1;
    mysql> source <PRODUCT_HOME>/dbscripts/mysql.sql;
    mysql> grant all on REGISTRY_LOCAL1.* TO regadmin@carbondbregadmin@"carbondb.mysql-wso2.com" identified by "regadmin";
     
    mysql> create database REGISTRY_LOCAL2;
    mysql> use REGISTRY_LOCAL2;
    mysql> source <PRODUCT_HOME>/dbscripts/mysql.sql;
    mysql> grant all on REGISTRY_LOCAL2.* TO regadmin@carbondbregadmin@"carbondb.mysql-wso2.com" identified by "regadmin";
  8. Configure the data sources for both nodes so that they point to the respective databases. 

    1. On the manager node, open <PRODUCT_HOME>/repository/conf/datasources/master-datasource.xml and configure the data sources to point to the REGISTRY_LOCAL1WSO2_REGISTRY_DB, and WSO2_USER_DB databases as follows (change the username, password, and database URL as needed for your environment):

      Code Block
      languagehtml/xml
      <datasources-configuration xmlns:svns="http://org.wso2.securevault/configuration"> 
           <providers> 
              <provider>org.wso2.carbon.ndatasource.rdbms.RDBMSDataSourceReader</provider> 
          </providers> 
          <datasources> 
              <datasource> 
                  <name>REGISTRY_LOCAL1</name> 
                  <description>The datasource used for registry- local</description> 
                  <jndiConfig> 
                      <name>jdbc/WSO2CarbonDB</name> 
                  </jndiConfig> 
                  <definition type="RDBMS"> 
                      <configuration> 
                          <url>jdbc:mysql://carbondb.mysql-wso2.com:3306/REGISTRY_LOCAL1?autoReconnect=true</url> 
                          <username>regadmin</username> 
                          <password>regadmin</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>REGISTRY_DB</name> 
                  <description>The datasource used for registry- config/governance</description> 
                  <jndiConfig> 
                      <name>jdbc/WSO2RegistryDB</name> 
                  </jndiConfig> 
                  <definition type="RDBMS"> 
                      <configuration> 
                          <url>jdbc:mysql://carbondb.mysql-wso2.com:3306/REGISTRY_DB?autoReconnect=true</url> 
                          <username>regadmin</username> 
                          <password>regadmin</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 registry and user manager</description> 
                  <jndiConfig> 
                      <name>jdbc/WSO2UMDB</name> 
                  </jndiConfig> 
                  <definition type="RDBMS"> 
                      <configuration> 
                          <url>jdbc:mysql://carbondb.mysql-wso2.com:3306/WSO2_USER_DB</url> 
                          <username>regadmin</username> 
                          <password>regadmin</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> 
         </datasources> 
      </datasources-configuration>
      Info

      Make sure to replace username and password with your MySQL database username and password.

    2. Repeat this configuration on the worker node, this time configuring the local registry to point to REGISTRY_LOCAL2:

      Code Block
      languagehtml/xml
      <datasources-configuration xmlns:svns="http://org.wso2.securevault/configuration"> 
           <providers> 
              <provider>org.wso2.carbon.ndatasource.rdbms.RDBMSDataSourceReader</provider> 
          </providers> 
          <datasources> 
              <datasource> 
                  <name>REGISTRY_LOCAL2</name> 
                  <description>The datasource used for registry- local</description> 
                  <jndiConfig> 
                      <name>jdbc/WSO2CarbonDB</name> 
                  </jndiConfig> 
                  <definition type="RDBMS"> 
                      <configuration> 
                          <url>jdbc:mysql://carbondb.mysql-wso2.com:3306/REGISTRY_LOCAL2?autoReconnect=true</url> 
                          <username>regadmin</username> 
                          <password>regadmin</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>REGISTRY_DB</name> 
                  <description>The datasource used for registry- config/governance</description> 
                  <jndiConfig> 
                      <name>jdbc/WSO2RegistryDB</name> 
                  </jndiConfig> 
                  <definition type="RDBMS"> 
                      <configuration> 
                          <url>jdbc:mysql://carbondb.mysql-wso2.com:3306/REGISTRY_DB?autoReconnect=true</url> 
                          <username>regadmin</username> 
                          <password>regadmin</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 registry and user manager</description> 
                  <jndiConfig> 
                      <name>jdbc/WSO2UMDB</name> 
                  </jndiConfig> 
                  <definition type="RDBMS"> 
                      <configuration> 
                          <url>jdbc:mysql://carbondb.mysql-wso2.com:3306/WSO2_USER_DB</url> 
                          <username>regadmin</username> 
                          <password>regadmin</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> 
         </datasources> 
      </datasources-configuration>
      Info

      Make sure to replace username and password with your MySQL database username and password.

  9. To configure the datasource, update the dataSource property found in <PRODUCT_HOME>/repository/conf/user-mgt.xml of the manager node as shown below:

    Code Block
    languagehtml/xml
    <Property name="dataSource">jdbc/WSO2UMDB</Property>

     

  10. Configure the shared registry database and mounting details in <PRODUCT_HOME>/repository/conf/registry.xml of the manager node as shown below:

    Code Block
    languagehtml/xml
    <dbConfig name="sharedregistry">
    	<dataSource>jdbc/WSO2RegistryDB</dataSource>
    </dbConfig>
    
    <remoteInstance url="https://localhost:9443/registry">
    	<id>instanceid</id>
    	<dbConfig>sharedregistry</dbConfig>
    	<readOnly>false</readOnly>
    	<enableCache>true</enableCache>
    	<registryRoot>/</registryRoot>
    	<cacheId>REGISTRY_DB@jdbc:mysql://carbondb.mysql-wso2.com:3306/REGISTRY_LOCAL1?autoReconnect=true</cacheId>
    </remoteInstance>
    
    <mount path="/_system/config" overwrite="true">
    	<instanceId>instanceid</instanceId>
    	<targetPath>/_system/asNodes</targetPath>
    </mount>
    
    <mount path="/_system/governance" overwrite="true">
    	<instanceId>instanceid</instanceId>
    	<targetPath>/_system/governance</targetPath>
    </mount>

    The following are some key points to note when adding these configurations:

...