Search code examples
dockerdocker-composeaerospike

How to install Aerospike tools in Docker?


I would like to use Aerospike in Docker.

I've tried to use a docker-compose.yml-file to help start the Aerospike server, and I would like to use aerospike tools to query data in the namespace, I found the offical link, but it needs me to create a container when I need to aql into database.

I would like to know if there are some good ways to use aerospike/tools in docker?

Note: Locally I'm running Debian 9, but that isn't supported by Aerospike yet, so have been unable install Aerospike outside of Docker.


Solution

  • The Community Edition server containers also has the tools and can be ran through docker exec.

    Check docker ps:

    docker ps
    CONTAINER ID        IMAGE               COMMAND                CREATED             STATUS              PORTS                              NAMES
    61fd93be15a3        aerotest            "/entrypoint.sh asd"   21 hours ago        Up 58 seconds       0.0.0.0:3000-3003->3000-3003/tcp   aerospike
    

    Run aql within container:

    docker exec -ti aerospike aql --no-config-file
    Seed:         127.0.0.1
    Config File:  None
    Aerospike Query Client
    Version 3.15.3.2
    C Client Version 4.3.5
    Copyright 2012-2017 Aerospike. All rights reserved.
    aql> 
    

    Insert a record:

    aql> INSERT INTO test.demo (PK, foo, bar) VALUES ('key1', 123, 'abc')
    OK, 1 record affected.
    

    Query for that record:

    aql> select * from test
    +-----+-------+
    | foo | bar   |
    +-----+-------+
    | 123 | "abc" |
    +-----+-------+
    1 row in set (0.140 secs)
    
    OK
    

    You can also use the examples in the aerospike github repo:

    https://github.com/aerospike/aerospike-tools.docker