Monday, August 8, 2016

How to Mount and Share Registry Between WSO2 Servers.

Most of the WSO2 products have embedded registry to that product which store data and persisting configuration. The Registry space provided to each product contains three major partitions.

  • Local Repository : Contains system configuration and runtime data that is local to the single instance of a product. This partition is not to be shared with multiple servers and can be browsed under /_system/local in the registry browser.
  • Configuration Repository : Contains product specific configuration. This partition can be shared across multiple instances of the same product and can be browsed under /_system/config in the registry browser.
  • Governance Repository :  Contains data and configuration shared across the platform. This partition can be made use of by multiple instances of various Carbon based products and can be can be browsed under /_system/governance in the registry browser.
We can mount registry between WSO2 carbon servers. Here I'm going to explain using WSO2 App Manager and WSO2 Identity Server.
  1. Create new database called APPM_REG_DB in MYSQL server
  2. Create tables inside the created database by executing the script in <APPM_HOME>/dbscripts/mysql.sql
  3. If App Manager and Identity Server are running on the same machine, follow this step.
  4. Set Offset value to 1 in /repository/conf/carbon.xml.
  5. Specify the datasource definition like below in the <APPM_HOME>/repository/conf/datasources/master-datasources.xml to connect early created APPM_REG_DB database to mount registry.
         <description>The datasource used for registry database</description>   
         <definition type="RDBMS">   
             <validationQuery>SELECT 1</validationQuery>   
  7. Add the same datasource configuration to <IS_HOME>/repository/conf/datasources/master-datasources.xml.
  8. Copy the database driver to both <IS_HOME>/repository/components/lib and <AppM_HOME>/repository/components/lib directories.
  9. Create the registry mounts by inserting the following sections to both <APPM_HOME>/repository/conf/registry.xml and <IS_HOME>/repository/conf/registry.xml file. Remember to not to replace the existing <dbConfig name="wso2registry">. Just add below configuration to the existing configuration.
       <dbConfig name="govregistry">  
       <remoteInstance url="https://localhost">    
       <mount path="/_system/governance" overwrite="true">  
       <mount path="/_system/config" overwrite="true">  
  11. Restart both server.
  12. That's all. Now both servers should see the same configs and governance registries.
  13. To confirm everything was successful, go to Home > Resources > Browse from management console. You can see "config" and "governance" repositories with an arrow as in below image.

No comments:

Post a Comment