There several ways of mounting a remote repository to a WSO2 product (In this case WSO2 EB). You can find more information on [3]. In this post I am trying to explain, how to mount a remote repository to WSO2 ESB via JDBC-based configuration.
In this approach you have to move the local DB of the WSO2 GREG to an external DB. So any change you do the registry will be reflected in the external DB. In this example I will be using a MYSQL database.
Moving WSO2 GREG repository to external DB
- Create a new database schema (regdb), a new user (wso2carbon) with password (wso2carbon) and grant all permissions to wso2carbon.
- Change the data source details of WSO2_CARBON_DB in
master-datasources.xml file, which is located in
GREG_HOME/repository/conf/datasources/, with your DB information.
eg:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
<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/regdb</url> <username>wso2carbon</username> <password>wso2carbon</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>
- Start the server with -Dseup argument
eg:
./wso2server.sh -Dseup
This will setup all the tables in the DB and all the initial configurations needed. And WSO2 GREG is now ready with external registry.
Mounting remote repository to WSO2 ESB
- Add a new data source to the master-datasources.xml file, which is
located in ESB_HOME/repository/conf/datasources/. NOTE: This entry is
exactly same as the record we entered in WSO2 GREG, except for the
<name> and <jndiConfig>/<name>
eg:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
<datasource> <name>WSO2_REG_DB</name> <description>The datasource used for registry and user manager</description> <jndiConfig> <name>jdbc/WSO2RegDB</name> </jndiConfig> <definition type="RDBMS"> <configuration> <url>jdbc:mysql://localhost:3306/regdb</url> <username>wso2carbon</username> <password>wso2carbon</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>
- Add a new record <dbConfig> to registry.xml, which is located at ESB_HOME/repository/conf/
eg:
1 2 3
<dbConfig name="wso2remoteregistry"> <dataSource>jdbc/WSO2RegDB</dataSource> </dbConfig>
- Uncomment the <remoteInstance> and <mount> sections in the registry.xml file and update with the correct details.
eg:
1 2 3 4 5 6 7 8 9 10 11 12 13
<remoteInstance url="https://localhost:9443/registry"> <id>instanceid</id> <dbConfig>wso2remoteregistry</dbConfig> <readOnly>false</readOnly> <enableCache>true</enableCache> <registryRoot>/</registryRoot> <cacheId>wso2carbon@jdbc:mysql://localhost:3306/regdb</cacheId> </remoteInstance> <mount path="/_system/config/nodes" overwrite="true"> <instanceId>instanceid</instanceId> <targetPath>/_system/nodes</targetPath> </mount>
- Start the WSO2 ESB. If you are running both WSO2 GREG and WSO2 ESB on
same machine, you will have to set port offsets on one of them.eg:
./wso2server.sh -DportOffset=2
To verify this go to resource browser of the admin console of the WSO2 ESB, https://localhost:9445, which you can find on the following URL if you start with postOffset=2
Then browse resources,
- You should find the mounted remote repository in _system/config/nodes with a folder icon having a blue arrow in it
- You should find the mounted remote repository details on _system/local/repository/components/org.wso2.carbon.registry/mount
References:
[1] http://wso2.com/products/governance-registry/
[2] http://wso2.com/products/enterprise-service-bus/
[3] https://docs.wso2.org/display/Governance460/Remote+Instance+and+Mount+Configuration+Details
No comments:
Post a Comment