This documentation is for WSO2 API Manager 2.6.0. View documentation for the latest release.

All docs This doc

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Removed the metrics related section DOCUMENTATION-8502

...

  • WSO2AM_DB: For API-M-specific data.

  • WSO2MB_DB: For message brokering data.

  • WSO2METRICS_DB : For storing data for Metrics metrics monitoring.
    Note that the metrics database is disabled by default in API-M 2.6.0, because if it is enabled it grows at a slower rate, but eventually it will consumer a lot of disk space and cause issues in production systems. However, if you need to work with metrics enable the metrics DB. For more information, see Enabling Metrics and Storage Types.

...

A datasource is used to establish the connection to a database. By default, datasource connections for the API-M database, API-M statistics database, and the Message Brokering database are configured in the master-datasources.xml file. The datasource connection for the Metrics database is configured in the metrics-datasources.xml file. These datasource configurations point to the default  H2 databases, which are shipped with the product. After setting up new databases to replace the default H2 databases, you can either change the default configurations in the above-mentioned files or configure new datasources.

...

  1. Connect to the database and run the relevant script. 
    For example, run the following command to create the MB tables in a MySQL database.

    Code Block
    languagepowershell
    mysql -u root -p -DWSO2MB_DB < '<API-M_HOME>/dbscripts/mb-store/mysql.sql';
    Note

    <API-M_HOME>/dbscripts/mb-store/mb-store/mysql.sql is the script that should be used for MySQL 5.6 and prior versions. If you database is MySQL 5.7 or later version, use <API-M_HOME>/dbscripts/mb-store/mb-store/mysql5.7.sql script file.

  2. Restart the WSO2 API-M server.

Create database tables in the Metrics database 

The DB scripts corresponding to the database type are provided in the <API-M_HOME>/dbscripts/metrics directory.

To create the necessary database tables:

  1. Connect to the database and run the relevant script. 
    For example, run the following command to create the MB tables in a MySQL database.

    Code Block
    languagepowershell
    mysql -u root -p -DWSO2_METRICS_DB < '<API-M_HOME>/dbscripts/metrics/mysql.sql';
    Note

    <API-M_HOME>/dbscripts/metrics/metrics/mysql.sql is the script that should be used for MySQL 5.6 and prior versions. If you database is MySQL 5.7 or later version, use <API-M_HOME>/dbscripts/metrics/metrics/mysql5.7.sql script file.

  2. Restart the WSO2 API-M server. 
Excerpt
hiddentrue

Note to writers: Add this content at the end of the page if any of the additional databases is relevant to your product.

Changing the identity/storage/product-specific databases

>The topics above show how to change the WSO2_CARBON_DB, which is used to store registry and user manager information. If you changed the product-specific database that comes by default or set up a separate database for identity or storage related data, the instructions are the same. In summary:

  1. For the identity databaseAdd it to the <PRODUCT_HOME>/repository/conf/datasources/<check the correct path and add file name (something like master-datasources.xml)>
    For the storage databaseAdd it to the <PRODUCT_HOME>/repository/conf/datasources/<check the correct path and add file name (something like master-datasources.xml)
    For the product-specific databaseAdd it to the <PRODUCT_HOME>/repository/conf/<check the correct path and add file name (something like api-manager.xml)
  2. Create the database tables using the following scripts:

    For the identity databaseUse <PRODUCT_HOME>/dbscripts/identity/<check the correct path and add file name (something like mysql.sql)>
    For the storage databaseUse  <PRODUCT_HOME>/dbscripts/storage/<check the correct path and add file name (something like /mysql/resoucre.sql)>
    For the product-specific databaseUse  <PRODUCT_HOME>/dbscripts/<check the correct path and add file name (something like /apimgt/mysql.sql)> 
  3. Update the following configurations, with the defined datasourcename of the corresponding database configuration you added to the <PRODUCT_HOME>/repository/conf/datasources/master-datasources.xml file.

    • If you are setting up a separate database to store identity relateddata, update the following configurations in the <PRODUCT_HOME>/repository/conf/identity.xml file.

      Code Block
      languagexml
      <JDBCPersistenceManager>
      	<DataSource>
      		<!-- Include a data source name (jndiConfigName) from the set of datasources defined in master-datasources.xml -->
      		<Name>jdbc/WSO2CarbonDB</Name>
      	</DataSource>
      </JDBCPersistenceManager>

      Note to writers: For step 3, add content on the XML files which include references on any of the additional databases and require edits that are relevant to your product similar to the given example.