# \[ES2.2\] how to run multiple elasticsearch nodes as processes on the same server

**URL:** <https://discuss.elastic.co/t/es2-2-how-to-run-multiple-elasticsearch-nodes-as-processes-on-the-same-server/41728>\
**Category:** Elasticsearch\
**Created:** [February 14, 2016, 6:58pm UTC](https://discuss.elastic.co/t/es2-2-how-to-run-multiple-elasticsearch-nodes-as-processes-on-the-same-server/41728 "2016-02-14T18:58:57Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![nskalis](https://avatars.discourse-cdn.com/v4/letter/n/ebca7d/32.png) [@nskalis](https://discuss.elastic.co/u/nskalis)\
**Post date:** [February 14, 2016, 6:58pm UTC](https://discuss.elastic.co/t/es2-2-how-to-run-multiple-elasticsearch-nodes-as-processes-on-the-same-server/41728/1 "2016-02-14T18:58:57Z")

</div>

hi guys,

i was wondering if you help me out here;  
am trying to run multiple elasticsearch processes on the same (CentOS) server, but i have been un-successful so far.  
and i have not enabled the service wrapper. and Elasticsearch has been installed using the .rpm package

the requirements are:

1. every instance belongs to a different cluster ([cluster.name](http://cluster.name))
2. every instance uses a different port, 9201, 9202, 9203, etc.
3. every instance should be parameterised with different ES\_HEAP\_SIZE

the `elasticsearch.yml` file is attached where all parameters are described.

and the questions are:

1. how to set a different configuration file per instance when `Des.config` seems to be deprecated in 2.2
2. how to set a custom ES\_HEAP\_SIZE (-Xmx=24G -Xms=24G) when

```auto
    # bin/elasticsearch -Des.config=config/IP-spotlight.RRv4/elasticsearch.yml 
    [2016-02-14 19:44:02,858][INFO][bootstrap] es.config is no longer supported. elasticsearch.yml must be placed in the config directory and cannot be renamed.

```

please help ..

---

<div class="post-metadata">

**Author:** ![molsznski](https://avatars.discourse-cdn.com/v4/letter/m/77aa72/32.png) [@molsznski](https://discuss.elastic.co/u/molsznski)\
**Post date:** [February 14, 2016, 7:09pm UTC](https://discuss.elastic.co/t/es2-2-how-to-run-multiple-elasticsearch-nodes-as-processes-on-the-same-server/41728/2 "2016-02-14T19:09:27Z")

</div>

Hi nskalis!

I would use Docker to configure an environment like that. That approach has a lot of benefits.

The biggest one is that it would be pretty easy to set up and support.

Best,  
Nick

---

<div class="post-metadata">

**Author:** ![nskalis](https://avatars.discourse-cdn.com/v4/letter/n/ebca7d/32.png) [@nskalis](https://discuss.elastic.co/u/nskalis)\
**Post date:** [February 23, 2016, 9:35pm UTC](https://discuss.elastic.co/t/es2-2-how-to-run-multiple-elasticsearch-nodes-as-processes-on-the-same-server/41728/3 "2016-02-23T21:35:02Z")

</div>

thanks @molsznski i followed your approach. but i have an issue with the kibana (docker version);

could you please advise why; when using --net=host the port mapping does NOT work ?  
for example,

```auto
"docker run -d --name=\"IP-spotlight.kibana.RRvpn\" --net=host --publish 5603:5601 -e ELASTICSEARCH_URL=http://nl-ams02c-ispdat02:9202 --label app=\"IP-spotlight\" --label component=\"kibana\" --label util=\"RRvpn\" cabana"

```

```auto
# telnet 127.0.0.1 5603
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused

```

```auto
# telnet 127.0.0.1 5601
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
^]

```

- when running the kibana image without the --net=host port mapping works but cannot connect to the elastic search instance
- i am running elasticsearch using the --net=host in order not for docker\_proxy to struggle with high IO

---

<div class="post-metadata">

**Author:** ![molsznski](https://avatars.discourse-cdn.com/v4/letter/m/77aa72/32.png) [@molsznski](https://discuss.elastic.co/u/molsznski)\
**Post date:** [February 25, 2016, 7:33pm UTC](https://discuss.elastic.co/t/es2-2-how-to-run-multiple-elasticsearch-nodes-as-processes-on-the-same-server/41728/4 "2016-02-25T19:33:06Z")

</div>

Hi @nskalis!

Basically, you should not have any performance penalty for using the docker networking stack.  
There are some great articles that stress test various docker networking strategies and, in a nutshell, you can have the goodies of both worlds if you need that at some point in time. I would not bother.

I am not a networking guy, though here are my thoughts based on some exp. When you use --net=host:

- You are on your own with networking
- I think, port mapping should be done via some additional script
- You might want to check out official docker docker docs when it comes to -net=host, since this is not really a default docker way to do it

Here is a sample docker-compose I use for dev

`  
elasticsearch:  
build: elk/elasticsearch/  
ports:  
- "9200:9200"  
- "9300:9300"  
volumes:  
- ./elk/elasticsearch/default\_config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml

logstash:  
image: logstash:2.2  
ports:  
- "5000:5000"  
volumes:  
- ./elk/logstash/config-dir:/config-dir  
links:  
- elasticsearch  
command: "logstash -f config-dir/logstash.conf"

kibana:  
image: kibana:4.4  
ports:  
- "5601:5601"  
links:  
- elasticsearch  
`

---

<div class="post-metadata">

**Author:** ![thn](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thn/32/8061_2.png) [@thn](https://discuss.elastic.co/u/thn)\
**Post date:** [February 25, 2016, 7:51pm UTC](https://discuss.elastic.co/t/es2-2-how-to-run-multiple-elasticsearch-nodes-as-processes-on-the-same-server/41728/5 "2016-02-25T19:51:36Z")

</div>

I have not tried v2.2 so my suggestion might not work... if you do RPM installation, check the startup script at /etc/init.d/elasticsearch. That's where I set the config location such as CONF\_DIR, CONF\_FILE.

If this works, you can make a copy of this script to es01, es02, etc... then have each pointing to /data/es01/config, /data/es02/config, etc.. where the elasticsearch.yml file for each instance exists. This way each instance can be started with its own elasticsearch.yml file.

---

<div class="post-metadata">

**Author:** ![thn](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thn/32/8061_2.png) [@thn](https://discuss.elastic.co/u/thn)\
**Post date:** [February 25, 2016, 7:58pm UTC](https://discuss.elastic.co/t/es2-2-how-to-run-multiple-elasticsearch-nodes-as-processes-on-the-same-server/41728/6 "2016-02-25T19:58:21Z")

</div>

For this multi-instance setup, one thing that you need to look out for beside the HEAP\_SIZE is the number of processors. You need to specifically set it per instance, otherwise, you will eventually run into problems related to the number of open files. I don't know about 2.2 but I've seen the problems at least with 2.1.x and 1.7.3.

For example, if the server physically has 16 cores, 64GB RAM, I normally reserve 50% RAM for Lucene, so I will have roughly 32GB left. In this case, I will run two instances with each has 30GB HEAP\_SIZE and upto 8 cores (I would start with 4 cores) This way ES will behave properly.

---

<div class="post-metadata">

**Author:** ![nskalis](https://avatars.discourse-cdn.com/v4/letter/n/ebca7d/32.png) [@nskalis](https://discuss.elastic.co/u/nskalis)\
**Post date:** [February 27, 2016, 5:48am UTC](https://discuss.elastic.co/t/es2-2-how-to-run-multiple-elasticsearch-nodes-as-processes-on-the-same-server/41728/7 "2016-02-27T05:48:59Z")

</div>

thanks @thn @molsznski

i eventually did dockerize only elastic search and left kibana running as normal processes in multiple ports.

i came across with the multiple systemd/init scripts solution but i didn't went for it because you can configure ES\_HEAP\_SIZE only in /etc/sysconfig/elasticsearch, thus you cannot specify multiple elastic search instances with different heap size while having elastic search running as a service.  
(please correct me if i am wrong)

that was the reason for deploying it with docker, because is a more standard way for other users to see how it has been deployed, with the mapping of configurations, directories, names, labels, tags to be just one command way.

---

<div class="post-metadata">

**Author:** ![thn](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thn/32/8061_2.png) [@thn](https://discuss.elastic.co/u/thn)\
**Post date:** [February 29, 2016, 12:04pm UTC](https://discuss.elastic.co/t/es2-2-how-to-run-multiple-elasticsearch-nodes-as-processes-on-the-same-server/41728/8 "2016-02-29T12:04:42Z")

</div>

@nskalis I'm using CentOS 6, I was able to set ES\_HEAP\_SIZE right in /etc/init.d/elasticsearch or es01, es02, etc listed above. I did not touch /etc/sysconfig/elasticsearch.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 11:12pm UTC](https://discuss.elastic.co/t/es2-2-how-to-run-multiple-elasticsearch-nodes-as-processes-on-the-same-server/41728/9 "2017-07-05T23:12:52Z")

</div>


