Friday, September 26, 2014

WSO2-IS Mounting User_Db and Registry in MySql



1. Create Mysql databases

Use following commands

mysql -u root -p
//Note that my username and password for mysql is root root

create database WSO2_USER_DB;
use WSO2_USER_DB;
source /dbscripts/mysql.sql;
source /dbscripts/identity/mysql.sql;
source /dbscripts/identity/application-mgt/mysql.sql;
grant all on WSO2_USER_DB.* TO root@"carbondb.mysql-wso2.com" identified by "root";

 create database REGISTRY_DB;
 use REGISTRY_DB;
source /dbscripts/mysql.sql;
 grant all on REGISTRY_DB.* TO root@"carbondb.mysql-wso2.com" identified by "root";

 create database REGISTRY_LOCAL1;
 use REGISTRY_LOCAL1;
 source /dbscripts/mysql.sql;
 grant all on REGISTRY_LOCAL1.* TO root@"carbondb.mysql-wso2.com" identified by "root";

2. Define the host name
For configuring permissions for the new database add the following line in  /etc/hosts file  
MYSQL-DB-SERVER-IP carbondb.mysql-wso2.com

3. Add MySQL JDBC driver 
Download MySQL driver  and copy the MySQL JDBC driver JAR (mysql-connector-java-x.x.xx-bin.jar) into the /repository/components/lib directory .

4. Configure master-datasources

        org.wso2.carbon.ndatasource.rdbms.RDBMSDataSourceReader 
     
     
         
            REGISTRY_LOCAL1 
            The datasource used for registry- local 
             
                jdbc/WSO2CarbonDB 
             
             
                 
                    jdbc:mysql://carbondb.mysql-wso2.com:3306/REGISTRY_LOCAL1?autoReconnect=true 
                    root 
                    root 
                    com.mysql.jdbc.Driver 
                    50 
                    60000 
                    true 
                    SELECT 1 
                    30000 
                 
             
         
         
            REGISTRY_DB 
            The datasource used for registry- config/governance 
             
                jdbc/WSO2RegistryDB 
             
             
                 
                    jdbc:mysql://carbondb.mysql-wso2.com:3306/REGISTRY_DB?autoReconnect=true 
                    root 
                    root 
                    com.mysql.jdbc.Driver 
                    50 
                    60000 
                    true 
                    SELECT 1 
                    30000 
                 
             
         
          
            WSO2_USER_DB 
            The datasource used for registry and user manager 
             
                jdbc/WSO2UMDB 
             
             
                 
                    jdbc:mysql://carbondb.mysql-wso2.com:3306/WSO2_USER_DB 
                    root 
                    root 
                    com.mysql.jdbc.Driver 
                    50 
                    60000 
                    true 
                    SELECT 1 
                    30000 
                 



5.Configuring user-mgt.xml
 
jdbc/WSO2UMDB

6. Configure registry xml
 Add following config
        
    
     jdbc/WSO2RegistryDB
    
  
 
     instanceid
     sharedregistry
     false
     true
     /
     root@jdbc:mysql://carbondb.mysql-wso2.com:3306/REGISTRY_DB?autoReconnect=true
 
  
 
     instanceid
     /_system/asNodes
 
  
 
     instanceid
     /_system/governance
 


7. Configure identity.xml 
Change dataSource name as follows
jdbc/WSO2UMDB


8.Configure application-authentication.xml 
Change dataSource name as follows
jdbc/WSO2UMDB


References
[1] - https://docs.wso2.com/display/CLUSTER420/Setting+up+the+Database

2 comments:

Shaf said...

Great blog. Was really helpful :)

Shaf said...

Great blog post.. was really helpful :)