Aerospike is a distributed NoSQL database purposefully designed for high performance web scale applications. Aerospike supports key-value and document data models, and has multiple data types including List, Map, HyperLogLog, GeoJSON, and Blob. Aerospike's patented hybrid memory architecture delivers predictable high performance at scale and high data density per node.
Aerospike Enterprise Edition requires a feature key file to start and to ungate certain features in the database, such as compression. Enterprise customers can use their production or development keys.
Anyone can sign up to get an evaluation feature key file for a full-featured, single-node Aerospike Enterprise Edition.
docker run -tid -v DIR:/opt/aerospike/etc/ -e "FEATURE_KEY_FILE=/opt/aerospike/etc/features.conf" --name aerospike -p 3000:3000 -p 3001:3001 -p 3002:3002 aerospike/aerospike-server-enterpriseAbove, DIR is a directory on your machine where you drop your feature key file. Make sure Docker Desktop has file sharing permission to bind mount it into Docker containers.
FEATKEY=$(base64 ~/Desktop/evaluation-features.conf)
docker run -tid -e "FEATURES=$FEATKEY" -e "FEATURE_KEY_FILE=env-b64:FEATURES" --name aerospike -p 3000:3000 -p 3001:3001 -p 3002:3002 aerospike/aerospike-server-enterpriseThe Aerospike EE Docker image has a default configuration file template
that can be populated with individual configuration parameters, as we did
before with FEATURE_KEY_FILE.
Alternatively, it can be replaced with a custom configuration file.
The following sections describe both advanced options.
You can inject parameters into the configuration template using container-side
environment variables with the -e flag.
For example, to set the default namespace name to demo:
docker run -tid --name aerospike -e "NAMESPACE=demo" -p 3000:3000 -p 3001:3001 -p 3002:3002 -v /my/dir:/opt/aerospike/etc/ -e "FEATURE_KEY_FILE=/opt/aerospike/etc/features.conf" aerospike/aerospike-server-enterpriseInjecting configuration parameters into the configuration template isn't compatible with using a custom configuration file. You can use one or the other.
FEATURE_KEY_FILE- thefeature_key_file. Default: /etc/aerospike/features.confSERVICE_THREADS- theservice_threads. Default: Number of vCPUsLOGFILE- thefileparam of theloggingcontext. Default: /dev/null, do not log to file, log to stdoutSERVICE_ADDRESS- the bindaddressof thenetworking.servicesubcontext. Default: anySERVICE_PORT- theportof thenetworking.servicesubcontext. Default: 3000HB_ADDRESS- thenetworking.heartbeataddressfor cross cluster mesh. Default: anyHB_PORT- theportfornetworking.heartbeatcommunications. Default: 3002FABRIC_ADDRESS- theaddressof thenetworking.fabricsubcontext. Default: anyFABRIC_PORT- theportof thenetworking.fabricsubcontext. Default: 3001
The single preconfigured namespace is in-memory with filesystem persistence
NAMESPACE- the name of the namespace. Default: testREPL_FACTOR- the namespacereplication-factor. Default: 2MEM_GB- the namespacememory-size. Default: 1, the unit is alwaysG(GB)DEFAULT_TTL- the namespacedefault-ttl. Default: 30dSTORAGE_GB- the namespace persistencefilesize. Default: 4, the unit is alwaysG(GB)NSUP_PERIOD- the namespacensup-period. Default: 120 , nsup-period in seconds
You can override the use of the configuration file template by providing your own aerospike.conf, as described in Configuring Aerospike Database.
You should first -v map a local directory, which Docker will bind mount.
Next, drop your aerospike.conf file into this directory.
Finally, use the --config-file option to tell Aerospike where in the
container the configuration file is (the default path is
/etc/aerospike/aerospike.conf). Remember that the feature key file is required,
so use feature-key-file in your config file to point to a mounted path (such
as /opt/aerospike/etc/feature.conf).
For example:
docker run -tid -v /opt/aerospike/etc/:/opt/aerospike/etc/ --name aerospike -p 3000:3000 -p 3001:3001 -p 3002:3002 aerospike/aerospike-server-enterprise --config-file /opt/aerospike/etc/aerospike.confWith Docker, the files within the container are not persisted past the life of
the container. To persist data, you will want to mount a directory from the
host to the container's /opt/aerospike/data using the -v option:
For example:
docker run -tid -v /opt/aerospike/data:/opt/aerospike/data -v /opt/aerospike/etc:/opt/aerospike/etc/ --name aerospike -p 3000:3000 -p 3001:3001 -p 3002:3002 -e "FEATURE_KEY_FILE=/opt/aerospike/etc/features.conf" aerospike/aerospike-server-enterpriseThe example above uses the configuration template, where the single defined namespace is in-memory with file-based persistence. Just mounting the predefined /opt/aerospike/data directory enables the data to be persisted on the host.
Alternatively, a custom configuration file is used with the parameter
file set to be a file in the mounted /opt/aerospike/data, such as in the
following config snippet:
namespace test {
# :
storage-engine device {
file /opt/aerospike/data/test.dat
filesize 4G
data-in-memory true
}
}
In this example we also mount the data directory in a similar way, using a custom configuration file
docker run -tid -v /opt/aerospike/data:/opt/aerospike/data -v /opt/aerospike/etc/:/opt/aerospike/etc/ --name aerospike -p 3000:3000 -p 3001:3001 -p 3002:3002 aerospike/aerospike-server-enterprise --config-file /opt/aerospike/etc/aerospike.confDocker provides an ability to expose a host's block devices to a running container.
The --device option can be used to map a host block device within a container.
Update the storage-engine device section of the namespace in the custom
aerospike configuration file.
namespace test {
# :
storage-engine device {
device /dev/xvdc
write-block-size 128k
}
}
Now to map a host drive /dev/sdc to /dev/xvdc on a container
docker run -tid --device '/dev/sdc:/dev/xvdc' -v /opt/aerospike/etc/:/opt/aerospike/etc/ --name aerospike -p 3000:3000 -p 3001:3001 -p 3002:3002 aerospike/aerospike-server-enterprise --config-file /opt/aerospike/etc/aerospike.confUpon restart, your lua cache will become emptied. To persist the cache, you
will want to mount a directory from the host to the container's
/opt/aerospike/usr/udf/lua using the -v option:
docker run -tid -v /opt/aerospike/lua:/opt/aerospike/usr/udf/lua -v /opt/aerospike/data:/opt/aerospike/data --name aerospike -p 3000:3000 -p 3001:3001 -p 3002:3002 -e "FEATURE_KEY_FILE=/opt/etc/aerospike/features.conf" aerospike/aerospike-server-enterpriseDevelopers using the Aerospike EE single-node evaluation, and most others using Docker Desktop on their machine for development, will not need to configure the node for clustering. If you're interested in using clustering and have a feature key file without a single node limit, read the following sections.
In order for the Aerospike node to properly broadcast its address to the cluster
and applications, the access-address
configuration parameter needs to be set in the configuration file. If it is not
set, then the IP address within the container will be used, which is not
accessible to other nodes.
network {
service {
address any # Listening IP Address
port 3000 # Listening Port
access-address 192.168.1.100 # IP Address used by cluster nodes and applications
}
Mesh networking requires setting up links between each node in the cluster. This can be achieved in two ways:
- Add a configuration for each node in the cluster, as defined in Network Heartbeat Configuration.
- Use
asinfoto send thetipcommand, to make the node aware of another node, as defined in tip command in asinfo.
For more, see How do I get a 2 nodes Aerospike cluster running quickly in Docker without editing a single file?
These images are based on debian:strech-slim.
Aerospike EE evaluation users, if you have any problems with or questions about this image, please post on the Aerospike discussion forum or open an issue in aerospike/aerospike-server-enterprise.docker.
Enterprise customers are welcome to participate in the community forum, but can also report issues through the enterprise support system.
If you are using the Aerospike Database EE evaluation feature key file, you are operating under the Aerospike Evaluation License Agreement.
If you are using a feature key file you received as part of your commercial enterprise license, you are operating under the Aerospike Master License Agreement.
