Tuesday, March 18, 2014

Mount (jdbc) WSO2 ESB registry to WSO2 Governance Registry Server with H2.

When you start the vanilla distribution of wso2 servers (WSO2 ESB , WSO2 Governance Registry , WSO2 Application Server ..etc) the default registry database is  "Embedded mode H2" . In this mode of connection it allows only one connection to the database.  Therefore if you need to mount ESB to external Governance Registry server, then it should have started with "Server mode H2"

Governance Registry Configurations:

1. Add the following  H2DatabaseConfiguration to the carbon.xml to start the Governance Registry with "Server mode H2.
        <property name="tcp" />
        <property name="tcpPort">9092</property>
        <property name="tcpAllowOthers" />        
2. Change the <url> of the default WSO2_CARBON_DB in master-datasources.xml file.
3. Start the Governance Registry server.

ESB Configurations

1. Add the following data source configuration for mount database in master-datasources.xml.
            <description>The datasource used for mounting registry databse</description>
            <definition type="RDBMS">
                    <validationQuery>SELECT 1</validationQuery>
 2. Add the following mount configuration in registry.xml
    <dbConfig name="wso2registry_mount">

    <remoteInstance url="https://localhost:9443/registry">

    <mount path="/_system/config" overwrite="true">
    <mount path="/_system/governance" overwrite="true">
3. If you are ruining ESB in same machine, change the default port <Offset> in carbon.xml  to prevent the port conflicts with Governance Registry server.

4. Start the ESB sever.

5. Logged in to the ESB server and browse the registry to verify that mount has established.

Note: We don't recommend to use the H2 as the mount database for production setup. However this method is useful for the users who don't  have rights to create the databases (MySQL , Oracle ..etc) in their corporate database system but still want to demo/test the registry space sharing/mounting.