Skip to main content

Docker Swarm Deployment


This guide describes how to deploy an Aerospike cluster in production with Docker Swarm. To deploy an Aerospike database as a single local node with Docker Desktop, see Install on macOS and Windows.

Why containers?

Containers are a simple way to:

  • Encapsulate the required frameworks and packages for the process you want to run.
  • Provide isolation at runtime, enabling containers with different dependencies such as OS kernel versions, to co-exist on the same physical host.

Application architectures are also evolving, especially with the adoption of micro-server-like architectures. An application is no longer one humongous, static binary or set of packages; it's more often a series of discrete services that are brought together dynamically at runtime. This is a natural fit for containers. But how does this fit with services that require persistence or long-running processes?

Why Aerospike and Containers?

Aerospike is naturally suited to container deployment because of its:

This enables you to:

  • Scale (up and out) the persistence layer
  • Eliminate reconfiguration of the application and database tier as containers enter and leave the topology
  • Utilize containers on your own dedicated infrastructure or public cloud providers

Aerospike's Community Edition is configured to transmit anonymous usage statistics. We ask your help in making Aerospike better by leaving this feature enabled. You can learn about our goals, how we use the data, and how to disable the feature here.

Download and run the container

Aerospike provides both CE images and EE images on Docker Hub.

You can also build your own container images from the Dockerfile on GitHub. (EE repo, CE repo)

  1. Create a Docker Daemon if you don't have one running already.

    $ docker-machine create -d vmwarefusion docker-daemon
    Running pre-create checks...
    Creating machine...
    Waiting for machine to be running, this may take a few minutes...
    Machine is running, waiting for SSH to be available...
    Detecting operating system of created instance...
    Provisioning created instance...
    Copying certs to the local machine directory...
    Copying certs to the remote machine...
    Setting Docker configuration on the remote daemon...
    To see how to connect Docker to this machine, run: docker-machine env docker-daemon
  2. Run the Aerospike container with docker run.

    $ eval $(docker-machine env docker-daemon)
    $ docker run -d --name aerospike aerospike/aerospike-server-enterprise

    Aerospike Database Enterprise Edition requires a feature-key file to be configured in aerospike.conf. Starting with Aerospike Database 6.1, a simple feature-key file is included with the Enterprise Edition Docker image. This evaluation feature-key file only allows deployment of a single-node cluster. If you already have a full feature-key file after purchasing Aerospike Database EE, run this command, replacing <DIRECTORY> with your feature-key file path:

    $ sudo docker run -tid --name aerospike -p 3000:3000 -p 3001:3001 -p 3002:3002 -v <DIRECTORY>:/etc/aerospike/ -e "FEATURE_KEY_FILE=/etc/aerospike/features.conf" aerospike/aerospike-server-enterprise
  3. Run docker ps to show all running containers.

    $ docker ps
    b33324047ab5 aerospike/aerospike-server "/ asd" 14 seconds ago Up 14 seconds 3000-3002/tcp aerospike

Test data insertion and retrieval

You can now run AQL in another Docker container to insert and query some data into the Aerospike server.

$ docker run -it aerospike/aerospike-tools aql -h  

$ (docker inspect -f '{{.NetworkSettings.IPAddress }}' aerospike)

aql> insert into (PK, foo) values ('123','my string')

OK, 1 record affected.

aql> select * from

| foo |
| "my string" |
1 row in set (0.028 secs)

If this works correctly, your database is now set up and ready for further development.

Next steps

The following guides detail how to deploy, configure, and utilize Aerospike from development through production.