# Running Two or more Elasticsearch clusters on one machine

**URL:** <https://discuss.elastic.co/t/running-two-or-more-elasticsearch-clusters-on-one-machine/252257>\
**Category:** Elasticsearch\
**Created:** [October 15, 2020, 7:01pm UTC](https://discuss.elastic.co/t/running-two-or-more-elasticsearch-clusters-on-one-machine/252257 "2020-10-15T19:01:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bretonj](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bretonj/32/77291_2.png) [@bretonj](https://discuss.elastic.co/u/bretonj)\
**Post date:** [October 15, 2020, 7:01pm UTC](https://discuss.elastic.co/t/running-two-or-more-elasticsearch-clusters-on-one-machine/252257/1 "2020-10-15T19:01:44Z")

</div>

I'm trying to get a second elasticsearch cluster running on a machine which already has a cluster. I have 7.9.2 installed on Ubuntu 18.04, and it's working properly. I created a new service file for the new cluster, new config folder, log and data folders, but everytime I try starting the new cluster it always seems to want to start a second instance of the first cluster. ie: it's trying to obtain a lock on the data path for the first cluster.

Through much trial and error I've finally come to the realization that /usr/share/elasticsearch/bin/elasticsearch-env is hard-coded to source /etc/default/elasticsearch.

So the only way I can start a second cluster so far is to start the first one, modify /etc/default/elasticsearch with the config path for the new cluster, and then start the new cluster.

At that point I have two clusters running on one machine, independent of each other. But now the problem I have is if I stop/start the old cluster. It now fails because of the modified /etc/default/elasticsearch.

Can anyone provide advice on how to get 2 clusters running on one box?

---

<div class="post-metadata">

**Author:** ![bretonj](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bretonj/32/77291_2.png) [@bretonj](https://discuss.elastic.co/u/bretonj)\
**Post date:** [October 19, 2020, 3:19pm UTC](https://discuss.elastic.co/t/running-two-or-more-elasticsearch-clusters-on-one-machine/252257/2 "2020-10-19T15:19:59Z")

</div>

After struggling with this for a while, I gave up and am now using Docker. I'm assuming that or some other containerized implementation is what most people are doing to get around my specific issue.

---

<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:** [November 16, 2020, 3:20pm UTC](https://discuss.elastic.co/t/running-two-or-more-elasticsearch-clusters-on-one-machine/252257/3 "2020-11-16T15:20:11Z")

</div>

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