Skip to main content

Deploying Aerospike clusters with Docker

note

This guide shows you how to deploy an Aerospike cluster in production by using Docker Swarm. If you want to deploy an Aerospike database as a single node on your laptop by using Docker Desktop, see our article on how to Install on macOS and Windows.

Why Containers?

Containers are seen as a simple way to:

  • Encapsulate the dependencies for the process you want to run, e.g. the packages required, the frameworks that need to be present etc.
  • Provides isolation at runtime, enabling containers each with different dependencies, O/S Kernel version etc. to co-exist on the same physical host.

Application architectures are also evolving, especially with the adoption of micro-server like architectures. Your application is no longer one humongous, static binary or set of packages, its starting to look like 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 require long running processes?

Why Aerospike and Containers?

Aerospike is naturally suited to container deployment because

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 infra-structure or public cloud providers
info

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.

Getting started

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

Users also have the ability to build their own container images from the Dockerfile on Github.(EE repo, CE repo)

Let's first 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

You can now run the Aerospike container and check its status with ps:

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

EE edition will require a feature key to be configured in aerospike.conf. Run this command, replacing <DIRECTORY> with the path of the directory where your feature-key file is located:

$ 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
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b33324047ab5 aerospike/aerospike-server "/entrypoint.sh asd" 14 seconds ago Up 14 seconds 3000-3002/tcp aerospike

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 test.foo (PK, foo) values ('123','my string') OK, 1 record affected. aql> select * from test.foo +-------------+ | foo         | +-------------+ | "my string" | +-------------+ 1 row in set (0.028 secs)

What's Next?

The following guides details how to deploy, configure and utilize Aerospike from Development through Production.