This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

To share topic-related information across multiple instances of Message Broker, you must set up the governance registry in an external database like MySQL or Oracle and share the registry across the MB nodes. For information on how to set up a database for the governance registry, see Setting Up Databases in the Governance Registry documentation. For example, to set up the governance registry database in MySQL, you will take the following steps:

  1. Install MySQL.
  2. Create a database called "regdb".
  3. Create a user called "regadmin" with password "regadmin".
  4. Give all privileges to the regadmin user for the regdb database.

After creating the registry database, you take the following steps for each Message Broker instance in the cluster:

Configure the local registry to use the default H2 database

First, configure the local registry to use the default H2 database.

  1. In <MB_HOME>/repository/conf/datasources/master-datasources.xml, add the WSO2_CARBON_DB data source under the <datasources> section as follows:

    <datasource>
        <name>WSO2_CARBON_DB</name>
        <description>The datasource used for registry and user manager</description>
        <jndiConfig>
            <name>jdbc/WSO2CarbonDB</name>
        </jndiConfig>
        <definition type="RDBMS">
            <configuration>
                <url>jdbc:h2:repository/database/WSO2CARBON_DB;DB_CLOSE_ON_EXIT=FALSE;LOCK_TIMEOUT=60000</url>
                <username>wso2carbon</username>
                <password>wso2carbon</password>
                <driverClassName>org.h2.Driver</driverClassName>
                <maxActive>50</maxActive>
                <maxWait>60000</maxWait>
                <testOnBorrow>true</testOnBorrow>
                <validationQuery>SELECT 1</validationQuery>
                <validationInterval>30000</validationInterval>
            </configuration>
        </definition>
    </datasource>
  2. In <MB_HOME>/repository/conf/registry.xml, add the wso2registry database configuration and point it to the WSO2CarbonDB data source you just created, as follows:

    <dbConfig name="wso2registry">
        <dataSource>jdbc/WSO2CarbonDB</dataSource>
    </dbConfig>

The local registry is now configured to use the default H2 database. Next, you will configure the governance registry to use the external database.

Configure the Governance Registry to use the external database

Take these steps to configure the governance registry to use the external database that you will share across MB nodes.

  1. In <MB_HOME>/repository/conf/datasources/master-datasources.xml, add the WSO2_GOV_DB data source under the <datasources> section as follows:

    <datasource>
    	<name>WSO2_GOV_DB</name>
    	    <description>The datasource used for registry and user manager</description>
    	    <jndiConfig>
            <name>jdbc/WSO2GovDB</name>
        </jndiConfig>
        <definition type="RDBMS">
            <configuration>
                <url>jdbc:mysql://localhost:3306/regdb</url>
                <username>regadmin</username>
                <password>regadmin</password>
                <driverClassName>com.mysql.jdbc.Driver</driverClassName>
                <maxActive>80</maxActive>
                <maxWait>60000</maxWait>
                <minIdle>5</minIdle>
                <testOnBorrow>true</testOnBorrow>
                <validationQuery>SELECT 1</validationQuery>
                <validationInterval>30000</validationInterval>
            </configuration>
        </definition>
    </datasource>
  2. In <MB_HOME>/repository/conf/registry.xml, add the wso2govregistry database configuration and point it to the WSO2GovDB data source you just created, as follows:

    <dbConfig name="wso2govregistry">
    <dataSource>jdbc/WSO2GovDB</dataSource>
    </dbConfig>
  3. In the same file, add a remote URL instance called govdb and point it to the wso2govregistry database configuration you created in the previous step:

        <remoteInstance url="https://localhost:9443/registry">
            <id>govdb</id>
            <dbConfig>wso2govregistry</dbConfig>
            <readOnly>false</readOnly>
            <enableCache>true</enableCache>
            <registryRoot>/</registryRoot>
        </remoteInstance>
  4. In the same file, add a mount to the govedb remote instance you created in the previous step:

        <mount path="/_system/governance" overwrite="true">
            <instanceId>govdb</instanceId>
            <targetPath>/_system/governance</targetPath>
        </mount>
  5. To enable registry sharing across the cluster, configure the following line in <MB_HOME>/repository/conf/axis2/axis2.xml:

    <clustering class="org.wso2.carbon.core.clustering.hazelcast.HazelcastClusteringAgent" enable="true">

Add relevant database drivers

Copy the database drivers for your database to the <MB_HOME>/repository/components/lib directory. For example, if you created a MySQL database, you would download the MySQL Java connector JAR from http://dev.mysql.com/downloads/connector/j/5.1.html. For other databases, follow the instructions in the topics under Setting Up Databases.

Start the databases

Start the external database server using the relevant command (such as start mysql for a MySQL database), and then start the Message Broker nodes using the -Dsetup flag to automatically create the local and external databases.

  • No labels