Wednesday, December 12, 2012

How to create JDBC mount with WSO2 Identity Server 4.0.0




Objective : Create a JDBC mount in between couple of IS instances to share governance artifacts.

To demonstrate I am using two wso2 IS instances and first instance call node1 and second one call node 2. Database will be MYSQL db as a common database.

1. As a First step create fresh mysql database [how-to]

Configure Node1 :

2. Go to the IS_HOME_NODE1/repository/conf/datasources directory and open the master-datasources.xml file

3. Update the url, username,password and driverClassName of the data source configuration.

<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:mysql://localhost:3306/reg_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>
 
4. Open the axis2.xml and enable clustering. (IS_HOME_NODE1 /repository/conf/axis2)
<clustering class="org.apache.axis2.clustering.tribes.TribesClusteringAgent" enable="true">
5. Start IS node 1.

Configure IS node 2 :

1. Open the master-datasources.xml file. It is under IS_HOME_NODE2/repository/conf/datasources and add a new datasource configuration.

<datasource>
<name>WSO2_CARBON_DB_IS</name>
<description>The datasource used for registry</description>
<jndiConfig>
<name>jdbc/WSO2CarbonDB_IS</name>
</jndiConfig>
<definition type="RDBMS">
<configuration>
<url>jdbc:mysql://localhost:3306/reg_db</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. Open the registry.xml file and add a new dbConfig for remote registry server.

<dbConfig name="wso2registry_registry">
<dataSource>jdbc/WSO2CarbonDB_IS</dataSource>
</dbConfig>
3. Add remote Registry instance to registry.xml.

<remoteInstance url="https://localhost:9443/registry">
        <id>instanceid</id>
        <dbConfig>wso2registry_registry</dbConfig>
        <readOnly>false</readOnly>
        <enableCache>true</enableCache>
        <registryRoot>/</registryRoot>
 </remoteInstance>
4. Add the mount configurations to registry.xml.

<mount path="/_system/config" overwrite="true">
    <instanceId>instanceid</instanceId>
    <targetPath>/_system/nodes</targetPath>
</mount> 
<mount path="/_system/governance" overwrite="true">
    <instanceId>instanceid</instanceId>
    <targetPath>/_system/governance</targetPath>
</mount>
5. Open the axis2.xml and enable clustering.

<clustering class="org.apache.axis2.clustering.tribes.TribesClusteringAgent" enable="true">
6. If both servers running on same machine change the port offset to different value of the carbon.xml

<Offset>1</Offset>
7. Start IS second node.

8. If configuration done successfully you will see the governance collection with symlink icon in IS node 2.


 
 
 
 




No comments: