This documentation is for WSO2 Storage Server 1.1.0. View documentation for the latest release.
Changing the Default RSS Configuration - Storage Server 1.1.0 - WSO2 Documentation
||
Skip to end of metadata
Go to start of metadata

Introduction

In order to use the RDBMS provisioning facility offered by WSO2 Storage Server, as the first step, you need to configure RDBMS servers using a configuration file. This includes setting up RSS metadate repository that is used to maintain user-created databases, database users and privilege templates. By default, the RSS metadata repository is pointed to an embedded H2 database that is shipped as part of the WSO2 Storage Server installation archive.

In a typical production setting, we recommend you to use an enterprise-grade RDBMS such as MySQL , SQL SERVER or Oracle as the RSS metadata repository. You can do this in 3 steps as follows:

  1. Create a database as the RSS metadata repository and a database user with admin privileges equivalent to the dba role. (this grants access to the database used as the RSS metadata repository)

    Please note that this database should be created in a database server which is of the same RDBMS type you are going to provision.   

  2. Select the SQL script appropriate to the RDBMS you have from <SS_HOME>/dbscripts directory and run it. This creates the RSS metadata repository database structure. For example, if your RDBMS is MySQL, the script you must run is <SS_HOME>/dbscripts /rss-manager/mysql/wso2_rss_mysql.sql.
  3. Add the required JDBC drivers for the database you selected to <SS_HOME>/repository/components/lib.
  4. Edit the parameters required to connect to the RSS metadata repository database as well as the database servers to be provisioned as explained below. 

Sample configuration

Following sample configuration shows how to change the default RSS configuration in WSO2 Storage Server.  It uses a database named rss_db as the RSS metadata repository, which is used to store metadata pertaining to databases, database users, database privilege templates, etc.

It also defines RSS provisioning environments that can be considered as a logical boundary separating a database server instance cluster from another. One typical example of using multiple provisioning environment is that, if you are running an application development infrastructure allowing users to develop applications in different environments within its life cycle, such as DEV, QA, STAGING, PROD, etc., you would ideally need to have separate database provider infrastructure per environment. The aforementioned feature can be a handful in provisioning all those environments with a single WSO2 Storage Server instance.

Follow the instructions below to configure RSS metadata repository and database instances you want to use for database provisioning. 

  1. Create a DataSource in the <PRODUCT_HOME>/repository/conf/datasources/master-datasources.xml file and point to that from the <PRODUCT_HOME>/repository/conf/etc/rss-config.xml file using its JNDI name.

    Do the following configuration changes in the  <PRODUCT_HOME>/repository/conf/datasources/master-datasources.xml file. (In this example, our metadata repository database name is “rss_db”. )

    SQL SERVER configurations:

    <datasource>
    	<name>MetadataRepo</name>
    	<jndiConfig>
    		<name>MetadataRepoDS</name>
    	</jndiConfig>
    	<definition type="RDBMS">
    		<configuration>
    			<dataSourceClassName>com.microsoft.sqlserver.jdbc.SQLServerXADataSource</dataSourceClassName>
    			<dataSourceProps>
    				<property name="serverName">localhost</property>
    				<property name="portNumber">1433</property>
    				<property name="databaseName">rss_db</property>
    				<property name="user">RootUser</property>
    				<property name="password">RootPassword</property>
    			</dataSourceProps>
    		</configuration>
    	</definition>
    </datasource>

    In this example, it uses Microsoft JDBC driver to connect to the database. You have to configure SQL Server to use XA datasource before configuring Storage Server. Configuration instructions can be found at http://msdn.microsoft.com/en-us/library/aa342335.aspx.

    You can also use jTDS JDBC driver instead of Microsoft driver. Then dataSourceClassName in the above configuration should be net.sourceforge.jtds.jdbcx.JtdsDataSource. The server configuration instructions for XA datasources can be found in the README.XA file in the jTDS driver distribution pack.

    MySQL configurations:

    <datasource>
    	<name>MetadataRepo</name>
    	<jndiConfig>
    		<name>MetadataRepoDS</name>
    	</jndiConfig>
    	<definition type="RDBMS">
    		<configuration>
    			<dataSourceClassName>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</dataSourceClassName>
    			<dataSourceProps>
    				<property name="URL">jdbc:mysql://localhost:3306/rss_db</property>
    				<property name="user">RootUser</property>
    				<property name="password">RootPassword</property>
    			</dataSourceProps>
    		</configuration>
    	</definition>
    </datasource>

    PostgreSQL configurations:

    <datasource>
    	<name>MetadataRepo</name>
    	<jndiConfig>
    		<name>MetadataRepoDS</name>
    	</jndiConfig>
    	<definition type="RDBMS">
    		<configuration>
    			<dataSourceClassName>org.postgresql.xa.PGXADataSource</dataSourceClassName>
    			<dataSourceProps>                         	 	 	 	
    				<property name="serverName">localhost</property>
    				<property name="portNumber">5432</property>
    				<property name="databaseName">rss_db</property>                     	 	 	 	
    				<property name="user">RootUser</property>
    				<property name="password">RootPassword</property>
    			</dataSourceProps>
    		</configuration>
    	</definition>
    </datasource>

    When creating above database user, make sure to grant all privileges for the database before creating any tables in it. (i.e. before you run the database script on database.)

    The elements of the sample configuration are explained below. You can use this information to edit the file according to your requirements. For more information please see configuring master datasources.

    Property NameDescriptionTypeDefault ValueFixed ValuesMandatory/Optional

    <dataSourceClassName>

    This is the XA Driver Class provided by the JDBC driver used to connect to the type of RDBMS in which the RSS metadata repository is configured.

    E.g., if RSS metadata repository database is configured on MySQL - "com.mysql.jdbc.jdbc2.optional.MysqlXADataSource" has to be used as the value of this particular attribute.

       Mandatory

    <dataSourceProps>

    Root element of the XA data source property collection that needs to be configured in order to initialize the XA datasource driver used in the RSS metadata repository configuration.

     

    -

    -

    Mandatory

    <property name="property_name">+

    Element used to specify bean properties of the XA datasource driver used in RSS metadata repository configuration. (Note: The set of properties that are to be configured are different based on the XA driver class used).

    E.g., the sample configuration which can be used to populate the bean properties required for MySQL XA driver is as follows:

    <dataSourceProps>
    	<property name = "URL">xxxx</property>
    	<property name = "user">xxxx</property>
    	<property name = "password">xxxx</property>
    </dataSourceProps>
     

    -

    -

    Mandatory

    The rss-config.xml file is located in <PRODUCT_HOME>/repository/conf/etc/rss-config.xml file.

    <ManagementRepository>
    	    <DataSourceConfiguration>
    			<JndiLookupDefinition>
    		     	<Name>MetadataRepoDS</Name>
    			</JndiLookupDefinition>
    	    </DataSourceConfiguration>
    </ManagementRepository>

    Please note that JNDI name of both config files should be the same. In this example, it is "MetadataRepoDS".

     

  2. Change following properties in <PRODUCT_HOME>/repository/conf/etc/persistence.xml.

    SQL SERVER configurations:

    <property name="openjpa.ConnectionDriverName" value="com.microsoft.sqlserver.jdbc.SQLServerXADataSource" />
    <property name="dialect" value="org.apache.openjpa.jdbc.sql.SQLServerDictionary" />

    MySQL configurations:

    <property name="openjpa.ConnectionDriverName" value="com.mysql.jdbc.jdbc2.optional.MysqlXADataSource" />
    <property name="dialect" value="org.apache.openjpa.jdbc.sql.MySQLDictionary" />

    PostgreSQL configurations:

    <property name="openjpa.ConnectionDriverName" value="org.postgresql.xa.PGXADataSource" />
    <property name="dialect" value="org.apache.openjpa.jdbc.sql.PostgresDictionary" />
  3. Configure the RSS Environment by using the following configuration in the rss-config.xml file.

    SQL SERVER configuration:

    <Provider>SQLSERVER</Provider>
    <Environments>
    		<Environment>
    			<Name>DEFAULT</Name>
    			<RSSInstances>
    				<RSSInstance>
    					<Name>WSO2RSS1</Name>
    					<InstanceType>SYSTEM</InstanceType>
    					<DbmsType>SQLSERVER</DbmsType>
    					<ServerCategory>LOCAL</ServerCategory>
    					<DataSourceConfiguration>
    						<Definition>
    							<Url>jdbc:sqlserver://localhost</Url>
    							<Username>RootUser</Username>
    							<Password>RootPassword</Password>
    							<DriverClassName>com.microsoft.sqlserver.jdbc.SQLServerDriver</DriverClassName>
    						</Definition>
    					</DataSourceConfiguration>
    				</RSSInstance>
    			</RSSInstances>
    		</Environment>
    </Environments>

    If you use jTDS JDBC driver, the DriverClassName should be net.sourceforge.jtds.jdbc.Driver.

    MySQL configuration:

    <Provider>MYSQL</Provider>
    
    <Environments>
    	<Environment>
    		<Name>DEFAULT</Name>
    			<RSSInstances>
    				<RSSInstance>
    					<Name>WSO2RSS1</Name>
    					<InstanceType>SYSTEM</InstanceType>
    					<DbmsType>MYSQL</DbmsType>
    					<ServerCategory>LOCAL</ServerCategory>
    					<DataSourceConfiguration>
    						<Definition>
    							<Url>jdbc:mysql://localhost:3306</Url>
    							<Username>RootUser</Username>
    							<Password>RootPassword</Password>
    							<DriverClassName>com.mysql.jdbc.Driver</DriverClassName>
    						</Definition>
    					</DataSourceConfiguration>
    				</RSSInstance>
    			</RSSInstances>
    	</Environment>
    </Environments>

    PostgreSQL configuration:

    <Provider>POSTGRES</Provider>
    
    <Environments>
    	<Environment>
    		<Name>DEFAULT</Name>
    		<RSSInstances>
    			<RSSInstance>
    				<Name>WSO2RSS1</Name>
    				<InstanceType>SYSTEM</InstanceType>
    				<DbmsType>POSTGRES</DbmsType>
    				<ServerCategory>LOCAL</ServerCategory>
    				<DataSourceConfiguration>
    					<Definition> 	 	 	
    						<Url>jdbc:postgresql://localhost:5432</Url>
    						<Username>postgres</Username>
    						<Password>postgres</Password>
    						<DriverClassName>org.postgresql.Driver</DriverClassName>
    					</Definition>
    				</DataSourceConfiguration>
    			</RSSInstance>
    		</RSSInstances>
    	</Environment>
    </Environments>

The elements of the sample configuration are explained below. You can use this information to edit the file according to your requirements.

XML elements of the sample configuration

Property NameDescriptionTypeDefault ValueFixed ValuesMandatory/Optional
<RSSConfiguration> Root element of RSS configuration document. --Mandatory
<Provider>Element used to configure the DBMS Type of the RSS instance.  

H2, MYSQL,

SQLSERVER,

POSTGRES

Mandatory
<ManagementRepository>

This element contains the data source configuration corresponding to the RSS metadata repository which is used to store metadata associated with database servers, databases, database users, etc.

 --Mandatory
<DataSourceConfiguration> Root element of the datasource configuration for the RSS metadata repository. --Mandatory
<JndiLookupDefinition>

Element used to point to the RSS metadata repository datasource in masterdatasource.xml via JNDI.

 --Mandatory
<Name>JNDI name of datasource.   Mandatory
      
<Environments>Root element that wraps the RSS environment configurations. --Mandatory
<Environment>+Element used to configure one particular RSS environment. --Mandatory
<Name>Element used to configure the name of the RSS environment. --Mandatory
<RSSInstances>Root element that wraps the RSS instances configured in the RSS environment to which they belong to. --Mandatory
<RSSInstance>+

Element used to configure one particular database server instance to be provisioned.

 --Mandatory
<Name>Element used to configure the name of the RSS instance.    
<InstanceType>Element used to configure the type of the RSS instance. Currently, the only supported value of this particular attribute is "SYSTEM". "SYSTEM" implies that the configured RSS instance would be provisioned as part of the logical database cluster named "SYSTEM". -SYSTEMMandatory
<DbmsType>

Element used to configure the DBMS Type of the RSS instance.

  

H2, MYSQL,

SQLSERVER,

POSTGRES

Mandatory
<ServerCategory>Obsolete attribute that is due to be removed from the immediate upcoming release of SS. LOCALRDS, LOCALMandatory
<DataSourceConfiguration>Root element of the datasource configuration of RSS instance. --Mandatory
<Definition>Root element of the datasource configuration definition. --Mandatory

<Url>

Element provided to configure the JDBC URL used to connect to the database server which is configured as the RSS instance. --Mandatory
<Username>Element provided to configure the username of the database user used to connect to the database server which is configured as the RSS instance. --Mandatory
<Password>Element provided to configure the password of the database user used to connect to the database server which is configured as the RSS instance. --Mandatory
<DriverClassName>Element provided to configure the JDBC driver class used to connect to the database server which is configured as the RSS instance. --Mandatory
  • No labels