How to create multiple running instances of Elasticsearch on a sever but on different ports?


I would to run two or more instances of ES on my server but on different ports.
e.g. http://localhost:9200, http://localhost:9201 ...

I created two different "elasticsearch.1.yml & elasticsearch.2.yml" with respected port numbers (http.port:9200 & http.port:9101), logs and data paths. The mentioned config files located under "elasticsearch-5.1.2/config/" folder. I tried to run "bin/elasticsearch -d" but it shows me only the instance with port 9200.

Can you please tell me where i am wrong and what have to do?

kind regards

1 Like

First of all don't do that. Unless you have more than 64Gb of RAM on your machine.

Then, only config/elasticsearch.yml is read.
You can create multiple config dirs if you wish and then start elasticsearch with -Epath.conf=config1.


1 Like

Thanks a lot, it helps me :wink:

I would like to add some other points to your suggested solution which may help others:

  1. For older version of Elasticsearch the command looks a bit different
    e.g. ES version 1.6. bin/elasticsearch -d -Des.path.conf=config1

  2. For each instance you need to create 'config, data, and logs' folders. e.g. create config1, config2, ...

  3. You may change ',,, path.logs and http.port' in config files "elasticsearch.yml" in config1 and config2 folders accordingly


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