How to deploy WSO2 API Manager with BAM

Create database named am_stats_db to store summarized data from BAM. You don't need to create any tables inside database (analyzer scripts will create them when need).

configure the data source definition in the master-datasources.xml file of API Manager and BAM as follows. We need this data source in bam to store summarized data(analyzer script do it). We use same data source inside API manager to pull out aggregated data to present it.
<datasource>
<name>WSO2AM_STATS_DB</name>
<description>The datasource used for getting statistics to API Manager</description>
<jndiConfig>
<name>jdbc/WSO2AM_STATS_DB</name>
</jndiConfig>
<definition type="RDBMS">
<configuration>
<url>jdbc:mysql://localhost:3306/am_stats_db</url>
<username>root</username>
<password>root</password>
<driverClassName>com.mysql.jdbc.Driver</driverClassName>
<maxActive>50</maxActive>
<maxWait>60000</maxWait>
<testOnBorrow>true</testOnBorrow>
<validationQuery>SELECT 1</validationQuery>
<validationInterval>30000</validationInterval>
</configuration>
</definition>
</datasource>


To enable API statistics collection you need to configure the following properties in the api-manager.xml
file of API Manager.


<!--Enable/Disable the API usage tracker.-->
<Enabled>true</Enabled>
<!-- JNDI name of the data source to be used for getting BAM statistics.This data source should be
defined in the master-datasources.xml file in conf/datasources directory. →>
<DataSourceName>jdbc/WSO2AM_STATS_DB</DataSourceName>



Change port offset to 1 by editing the repository/conf/carbon.xml if you are running all servers in same box(This step is required as we publish data to port 7712 from API manager). For more details go to usage tracking section of api-manager.xml file and change it as required.

Copy the API_Manager_Analytics.tbox(available under wso2am-1.3.0/statistics) to repository/deployment/server/bam-toolbox (Create the bam-toolbox directory if it already doesn't exist) Copy the MYSQL JDBC driver jar file into the INSTALL_HOME/repository/component/lib folder for all APIManager/ BAM servers.

So you are almost done start both servers. And see how API usage data publish to bam and summarize there.

1 comment:

Empowering the Future of API Management: Unveiling the Journey of WSO2 API Platform for Kubernetes (APK) Project and the Anticipated Alpha Release

  Introduction In the ever-evolving realm of API management, our journey embarked on the APK project eight months ago, and now, with great a...