×
☰ See All Chapters

How to Install Aerospike

Step 1: Install Docker

Aerospike does not available for windows OS, we are installing Aerospike in a docker container. Before installing Aerospike, docker should be installed in your machine. Follow our Docker Installation Tutorial to learn to install Docker in windows OS.

Step 2: Pull Aerospike Image

Use Docker to pull an Aerospike Enterprise Edition image from Docker Hub. In the terminal, run this command to pull an image of the current version:

docker pull aerospike/aerospike-server-enterprise

how-to-install-aerospike-0
 

Step 3: Download Aerospike Evaluation Key

  1. Go to aerospike.com and click the Try Now button in the top-right corner of the homepage. 

  2. Fill in the first four fields of the form, then click on download. 

how-to-install-aerospike-1
 

Now you will see the Thank you message.

how-to-install-aerospike-2
 

Open your email box and follow the installation instructions sent by aerospike.

how-to-install-aerospike-3
 

In the email, click the link in "Get your evaluation key" link. Click the Download icon in the top-right corner of the page to save the file trial-features.conf to your system. Create a directory and save this file.

Step 4: Start Container

Start a container and the database by using aerospike image. Run the below docker run command.

docker run --rm -tid --name aerospike -p 3000:3000 -p 3001:3001 -p 3002:3002 -v C:\Users\Manu\Desktop\Aerospike_key\trial-features.conf:\aerospike\etc\trial-features.conf -e "FEATURE_KEY_FILE=\aerospike\etc\trial-features.conf" -e "NAMESPACE=demo" aerospike/aerospike-server-enterprise

how-to-install-aerospike-4
 

Below are complete details of options used in the command:

docker run --rm -tid --name aerospike -p 3000:3000 -p 3001:3001 -p 3002:3002 -v <local-path-to-license-file>:<container-path-to-license-file> -e "FEATURE_KEY_FILE=<container-path-to-license-file>" -e "NAMESPACE=<name-of-namespace>" aerospike/aerospike-server-enterprise

Replace the text < directory-of-license-file > with the absolute path to the directory containing your trial-features.conf file. If using Windows Linux Subsystem, make sure to use your Windows backslashes and drive designations.

  • --rm -- Removes anonymous volumes associated with the container when the container is removed. 

  • -t -- Allocates a pseudo-TTY. 

  • -i -- Keep STDIN open, even if it is not attached. 

  • -d -- Runs the container in background and prints the container ID. 

  • --name -- Assigns a name to the container 

  • -p -- Publishes the container's ports to the host. 

  • -v – It is used by docker volumes to inject files from your host machine to the container when running it. 

Use backslashes or forward slashes in the path based on the operating system. In the above example we are running docker in windows and container is formed by linux, accordingly we used path.

  • -e "FEATURE_KEY_FILE=<container-path-to-license-file > " -- Sets the value of the environment variable to the path of the license file in the volume. 

  • -e "NAMESPACE=<\name-of-namespace>" -- Optional: Sets the name of the namespace to create in the database. The default is test. If you want to specify a non-default name, replace <name-of-namespace> with the name of your choice. Here are the naming guidelines: Maximum length: 31 bytes. Do not use either a colon (:) or a semicolon (;). Avoid using the reserved word null. 

  • aerospike/aerospike-server-enterprise -- Specifies the name of the image. 

If you would like to use more options in the docker run command, its reference documentation is here.

Step 5: Verify that the container is running

Run the docker ps command. The output should resemble this:

how-to-install-aerospike-5
 

Also, you can verify if container running from docker desktop as show below:

how-to-install-aerospike-6
 

Step 6: Test aerospike running inside docker container

You can use AQL, Aerospike's command-line data browser, to check that the database is running by inserting a record into it and then reading the record back. Then, you can download a client library and start developing.

Use Docker to pull an image of the current aerospike-tools package.

In the terminal, run this command:

docker pull aerospike/aerospike-tools

how-to-install-aerospike-7
 

To start a container and AQL by using this image, In the terminal, run this command:

docker run -it aerospike/aerospike-tools aql -h  <ip-addressof-container>

When you are running docker from windows then all containers share same IP address of host. To get the IP address of Host run “ipconfig” command.

how-to-install-aerospike-8
 

Example: docker run -it aerospike/aerospike-tools aql -h 172.26.0.1

how-to-install-aerospike-9
 

Insert a record into the database.

Issue this statement, where:

  • <name-of-namespace> is the name that you gave to the namespace in the docker run command for starting the database. 

  • <name-of-set> is a name to use to create a set within the namespace. 

insert into <name-of-namespace>.<name-of-set> (PK, test) values (123, 'test-value')

Example: insert into demo.demoset (PK, test) values (123, 'test-value')

how-to-install-aerospike-10
 

Query the database.

You can issue a simple select \* statement to read back the record:

select * from <name-of-namespace>.<name-of-set>

Example: select * from demo.demoset

how-to-install-aerospike-11
 

 

 

 

 

 

 

 


All Chapters
Author