Multiple Nodes of Elastic Search


(Ayushi Dalmia) #1

I am using elasticsearch using docker-compose. This is how my docker-compose looks like:

elasticsearch:
image: elasticsearch:2.4
command: elasticsearch -Des.network.host=0.0.0.0
environment:
- cluster.name=docker-cluster
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- /data/elasticsearch:/usr/share/elasticsearch/data

I create an index "my_index" using the above and add in my data. Now in /data/elasticsearch/nodes/ there are multiple nodes from 0/, 1/, 2/.

Now, if I create another instance of the elasticsearch container, it is not able to find "my_index"

Why so?


(David Pilato) #2

Are you creating another instance while the first one is running?


(Ayushi Dalmia) #3

Yes. But the path for both the instance is same. /data/elasticsearch:/usr/share/elasticsearch/data


(David Pilato) #4

Each node is a separated instance and has its own data dir.
If you want to form a cluster, then change the configuration accordingly.

Elasticsearch will then duplicate the data for you wherever data dir is.


(Ayushi Dalmia) #5

Can you point me to the relevant link for setting this up correctly?

Also, is it possible to have just one node?


(David Pilato) #6

This and the other related sections https://www.elastic.co/guide/en/elasticsearch/reference/current/discovery-settings.html

One node only? Yes. This is what you did yet, no?


(Ayushi Dalmia) #7

I don't explicitly set anything. However under nodes, there are multiple directories with id 0,1,2,3,..,12. Each containing a subdirectory called index with a particular index.

Now, when I start an instance of the container, I think it loads only one of these directories under nodes. I want each instance to have access to all the indices.

How can I achieve it?


(xeraa) #8

Your instances need to form a cluster — you can check that with curl <ip>:<port>/_cat/nodes and the IP and port of an Elasticsearch instance. You will need to configure discovery.zen.ping.unicast as described in the relevant docs.

PS: We don't support Elasticsearch 2.4 any more, so you should definitely upgrade. Also the Docker image you are using is not from us, but from Docker. You can get our images from https://www.docker.elastic.co.


(system) #9

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.