Step 3 – Start external data stores

If you are using any external data stores, such as Apache Cassandra for API Manager, or a metrics database for API Manager or API Gateway Analytics you must start them.

Start Apache Cassandra

Note   Deploying a Cassandra container is only recommended for development environments. In a production environment, you must configure Cassandra for high availability (HA) as detailed in Configure a Cassandra HA cluster in the API Gateway Apache Cassandra Administrator Guide.

If you are using Apache Cassandra, you can use the docker run command to start a Cassandra version 2.2.12 container. For example:

$ docker run -d -p 9042:9042 --name=cassandra2212 --network=api-gateway-domain cassandra:2.2.12

This example performs the following:

  • Downloads a Cassandra 2.2.12 Docker image from the public Docker registry.
  • Starts an Apache Cassandra 2.2.12 container named cassandra2212.
  • Binds the Cassandra port 9042 of the container to port 9042 on the host machine. This enables you to access Cassandra on port 9042 of your host machine.

Start metrics database

If you are using a metrics database, you can use the docker run command to start a database container. For example:

$ cd emt_containers-<version>
$ cp quickstart/mysql-analytics.sql /tmp/sql
$ docker run -d --name metricsdb --network=api-gateway-domain 
-v /tmp/sql:/docker-entrypoint-initdb.d 
-e MYSQL_ROOT_PASSWORD=root01 -e MYSQL_DATABASE=metrics 
mysql:5.7

This example performs the following:

  • Downloads a MySQL 5.7 Docker image from the public Docker registry.
  • Mounts the host directory /tmp/sql (containing a MySQL metrics database creation script) inside the container.
  • Uses environment variables MYSQL_ROOT_PASSWORD and MYSQL_DATABASE to specify the database root password and the database name.
  • Starts a MySQL container named metricsdb.

Related Links