Skip to content

Deploy Aerospike Graph Service with Docker

Overview

This page describes how to run Aerospike Graph Service (AGS) using Docker and connect to an Aerospike database cluster.

Prerequisites

  • An Aerospike feature key file which has the graph-service key enabled. Click here to get a free 60 day trial key, or contact your Aerospike account manager.

  • A running Aerospike Database instance, version 7.0 or later. You can either connect to an existing cluster, or start one using Docker. See Install with Docker to set up an Aerospike Database with Docker.

    • Verify the IP address of your Aerospike database. If you are running Aerospike in a Docker container locally, you can get the IP address with the following command:
    Terminal window
    docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' AEROSPIKE_CONTAINER_ID
  • Replace AEROSPIKE_CONTAINER_ID with the Docker container ID of your Aerospike container.

Aerospike database environment requirements

  • If access control is enabled on the Aerospike database, AGS must have the following privileges as a database user: sys-admin and read-write.

  • The namespace which AGS uses on your Aerospike database server must not have the configuration option default-ttl set to anything but 0. See the instructions for setting this option after the server has started.

Run AGS with Docker

  1. Pull the AGS Docker image.

    Terminal window
    docker pull aerospike/aerospike-graph-service

    Or, if running in GCP, pull from the Google Container Registry:

    Terminal window
    docker pull gcr.io/aerospike-prod/aerospike-graph-service
  2. Run the AGS Docker container.

    Terminal window
    docker run -p8182:8182 -e [OPTIONS] aerospike/aerospike-graph-service

    The options you pass to your Docker command specify which Aerospike database cluster to connect to, which namespace, which default indexes to create, and more. For a complete list of available configuration options, see Configuration options.

    You can also specify configuration options with a properties file (recommended).

    The following example Docker command starts an AGS instance:

    Terminal window
    docker run -d -p8182:8182 -e aerospike.client.namespace="test" \
    -e aerospike.client.host="HOSTNAME:PORT" \
    aerospike/aerospike-graph-service

    Replace HOSTNAME:PORT with the hostname and port of your Aerospike database server.

Server output

AGS writes logs to stdout. When running in Docker, these logs are captured by Docker and available through docker logs. For a complete list of command options, see the Docker documentation.

If you start your AGS Docker container with the -d option, the server output does not appear in your terminal window. You can find it with the docker logs command:

Terminal window
docker logs -f [CONTAINER_NAME]

After successfully completing the startup procedure, you are ready to start using AGS. See Graph Quickstart to get started on interacting with your graph data.

Configure AGS logging

Use Docker’s log driver options to rotate and cap AGS logs. The example below uses the json-file log driver with rotation settings. Adjust sizes and file counts for your environment.

Terminal window
docker run \
--log-driver=json-file \
--log-opt max-size=10m \
--log-opt max-file=5 \
-p8182:8182 \
-e aerospike.client.namespace="test" \
-e aerospike.client.host="HOSTNAME:PORT" \
aerospike/aerospike-graph-service

TTL on the Aerospike namespace

The Aerospike database namespace which AGS uses must not have the configuration option default-ttl set to anything but 0. If you see an AGS startup error referring to the default-ttl configuration option, use the following procedure to set it to 0:

  1. Start the Aerospike Tools Docker image:

    Terminal window
    docker run -it aerospike/aerospike-tools asadm -h HOSTNAME
  2. Enable dynamic configuration changes with the following command at the Admin> prompt:

    Terminal window
    enable
  3. Set your namespace’s default-ttl option to 0:

    Terminal window
    manage config namespace NAMESPACE_NAME param default-ttl to 0

Configuration options

This section describes how to specify AGS configuration options at startup using a Docker flag or a properties file.

Specify AGS configurations using environment variables

Use the -e flag, passed with the docker run command, to set an environment variable in the container. In this example, the flag is used to set aerospike.client.namespace and aerospike.client.host.

Terminal window
docker run -p8182:8182 -e aerospike.client.namespace="test" \
-e aerospike.client.host="HOSTNAME:PORT" \
aerospike/aerospike-graph-service

Use a properties file

The following example illustrates a properties file that specifies configuration options and their values.

aerospike.client.namespace=test
aerospike.client.host=aerospike-devel-cluster-host1:3000, aerospike-devel-cluster-host2:3000
aerospike.graph.index.vertex.properties=property1, property2
aerospike.graph.index.vertex.label.enabled=true

To use a properties file when running the AGS Docker image, use the -v flag to create a volume bind. In the following example, the full local path to the properties file is /home/graph-user/graph/conf/aerospike-graph.properties. The filepath after the :, /opt/aerospike-graph/aerospike-graph.properties, is the corresponding properties file in the AGS Docker container.

Terminal window
docker run -p 8182:8182 \
-v /home/graph-user/graph/conf/aerospike-graph.properties:/opt/aerospike-graph/aerospike-graph.properties \
aerospike/aerospike-graph-service
Feedback

Was this page helpful?

What type of feedback are you giving?

What would you like us to know?

+Capture screenshot

Can we reach out to you?