Pages

Setting up a MySQL server for WSO2 API Manager

Introduction

WSO2 API Manager is a complete solution for designing and publishing APIs, creating and managing a developer community, and for scalably routing API traffic. Download and try the product here
API Manager uses three databases. The following databases are shared among the server nodes.
  • User Manager Database - Stores information related to users and user roles. This information is shared among the Key Manager Server, Store, and Publisher. Users can access the Publisher for API creation and the Store for consuming the APIs.
  • API Manager Database - Stores information related to the APIs along with the API subscription details. The Key Manager Server uses this database to store user access tokens that are used for verification of API calls.
  • Registry Database - Shares information between the Publisher and Store. When an API is published through the Publisher, it is made available in the Store via the sharing registry database.

In this post we are going to install MySQL as the database server, create the above three databases and configure the WSO2AM 1.7.0 to use the MySQL server 5.5.

Installing and Configuring

  1. Download and install MySQL Server. Start and run the MySQL server.
  2. Download the MySQL JDBC driver.
  3. Unzip the downloaded MySQL driver zipped archive, and copy the MySQL JDBC driver JAR (mysql-connector-java-x.x.xx-bin.jar) into the {APIM_HOME}/repository/components/lib directory.
  4. Create the three databases using the following commands, where  is the path to any of the API Manager instances you installed, and username and password can be your intended credentials.
  5. Open the {APIM_HOME}/repository/conf/datasources/master-datasources.xml file. Enable access to the the API Manager, User Manager and Registry databases by modifying the WSO2AM_DB, WSO2UM_DB and WSO2REG_DB data sources in the master-datasources.xml file as follows:
  6. Modify the /etc/hosts entries to map the IP addresses to the data source URLs:
      • 127.0.0.1 apimgtdb.mysql-wso2.com
      • 127.0.0.1 userdb.mysql-wso2.com
      • 127.0.0.1 regdb.mysql-wso2.com
  7. To give component access to the API Manager database, open the {APIM_HOME}/repository/conf/api-manager.xml file and add the following line as the first child node of the root element (if it is not already there):
     
  8. To give access to the users database with shared permissions, open the {APIM_HOME}/repository/conf/user-mgt.xml file and add or modify the dataSource property of the  element as follows:
  9. To give access to the registry database, open the {APIM_HOME}/repository/conf/registry.xml file and modify the dataSource attribute of the  element as follows:

No comments:

Post a Comment