Monday, November 3, 2014

Pointing governance registry to a MySQL database

Take WSO2 instance (here, I'm taking WSO2 AS) and do the following configurations

1. Modify the master-datasource.xml file

<datasource>
            <name>asgove</name>
            <description>The datasource used for governance registry</description>
            <jndiConfig>
                <name>jdbc/asgove</name>
            </jndiConfig>
            <definition type="RDBMS">
                <configuration>
                    <url>jdbc:mysql://localhost:3306/asgove?autoReconnect=true</url>
                    <username>root</username>
                    <password>root</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>

2. Modify the registry.xml file

 <dbConfig name="asgove">
        <dataSource>jdbc/asgove</dataSource>
    </dbConfig>

<mount path="/_system/governance" overwrite="true">
        <instanceId>asgove</instanceId>
        <targetPath>/_system/as/governance</targetPath>
    </mount>

    <remoteInstance url="https://localhost:9443/registry">
        <id>asgove</id>
        <dbConfig>asgove</dbConfig>
        <readOnly>false</readOnly>
        <enableCache>true</enableCache>
        <registryRoot>/</registryRoot>
        <cacheId>root@jdbc:mysql://localhost:3306/asgove</cacheId>
    </remoteInstance>

Don't forget to add the MySQL jars to the component/lib folder

Restart the instance with -Dsetup

No comments: