1

I have my aerospike data located in /aerospike/data/ directory in my host machine.

I have installed and configured aerospike server in docker by following this link.

Following are my configuration files for docker container Dockerfile, entrypoint.sh, aerospike.conf

I am able to connect to aerospike query console using command below

docker exec -ti my_aerospike_container aql

But select query below is not showing any data:

select * from test;

I also tried to access this data from a webapp deployed in another container in same docker instance. But there also data is not accessible.

Can anyone please help me with this?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
vsbehere
  • 666
  • 1
  • 7
  • 23

3 Answers3

3

The VOLUME instruction in Dockerfile does not copy the contents of the host machine into the container. It only creates a mount point. The mount point can be used either by a directory inside the image or it can be used by the host machine running the container. Assuming you want your host machine's data directory to be used by the container, you should specify that in your docker run command using the -v option. It should be something like below

docker run -v "/path/to/local/data:/aerospike/data" myimage

Read more about the VOLUME instruction from docker reference (esp the notes) and this stackoverflow discussion.

sunil
  • 3,507
  • 18
  • 25
  • Hello, I have already added volume in docker file. Check docker file link in my question, you will see line VOLUME ["/aerospike/data/"] there. – vsbehere Dec 14 '18 at 13:59
  • 2
    Having the `volume` line inside the Dockerfile does not mount anything. It just "preps" the container image for where potential mounts would go. You need to have the `-v ...` param to your `docker run` to actually mount a volume. – Richard Dec 14 '18 at 18:21
  • 2
    @vsbehere yes, I saw that. But that is not going to work. Please read my answer and the links again. – sunil Dec 15 '18 at 14:35
0

Should be without semicolon. Did you try that, or its a typo here?

aql> select * from test
pgupta
  • 5,130
  • 11
  • 8
  • What is the output of: 1) aql> show namespaces 2) aql> show sets 3) Try inserting a record and then do select * afterwards: aql> insert into test (PK, name, age) values ('key1', 'Jack', 30) – pgupta Dec 11 '18 at 02:25
  • I tried your steps. Obviously they worked as there is no issue in starting aerospike service. My question is about reading existing data from data directory on host machine. – vsbehere Dec 11 '18 at 06:33
  • Well, what is in Aerospike1.txt file? Does it have data that Aerospike wrote into previously? Because based on your config file, when you insert using AQL, its going in that file. So I don't quite understand what you were expecting to read? – pgupta Dec 12 '18 at 07:19
  • I have aerospike installed on my host machine from where I added data into this file. Now I am trying to read this data inside the docker. The aerospike config files used in both aerospike instances are exact replica of each other. – vsbehere Dec 12 '18 at 07:51
  • so, in docker's world, you first copy over to: /aerospike/data the Aerospike1.txt file over from the "host"? – pgupta Dec 12 '18 at 16:39
-2

If you want to move data from one cluster to another, use asbackup / asrestore tools provided by Aerospike. asbackup also allows you to grab a percentage of the total data - say 5% sample - as a "production sample" for dev purposes. Swapping storage mediums is not trivial and will not always work correctly depending on source and destination cluster sizes.

pgupta
  • 5,130
  • 11
  • 8