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 6.4 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:
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:
truncate
,sys-admin role
,sindex-admin
,read-write
.
Run AGS with Dockerโ
Pull the AGS Docker image.
docker pull aerospike/aerospike-graph-service
OR
(optional) Pull from the Google Container Registry if running in GCP:
docker pull gcr.io/aerospike-prod/aerospike-graph-service
Run the AGS Docker container.
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, namespace, default indexes to create and much more. For a complete list of available config options, see Configuration Options.
You can also specify configuration options with a properties file (recommended).
The following example Docker command starts an AGS instance:
docker run -d -p8182:8182 -e aerospike.client.namespace="test" \
-e aerospike.client.host="<HOSTNAME:PORT>" \
aerospike/aerospike-graph-serviceReplace
<HOSTNAME:PORT>
with the hostname and port of your Aerospike database server.
Server outputโ
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:
docker logs -f [<CONTAINER_NAME>]
After successfully completing the startup procedure, you are ready to start using AGS. See Basic usage to get started on interacting with your graph data.
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 environmental variable in the container. In this example, the flag is used to set aerospike.client.namespace
and aerospike.client.host
.
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.
docker run -p 8182:8182 \
-v /home/graph-user/graph/conf/aerospike-graph.properties:/opt/aerospike-graph/aerospike-graph.properties \
aerospike/aerospike-graph-service