# Multiple JVM (instances) in same machine sharing same data and log directory

**URL:** <https://discuss.elastic.co/t/multiple-jvm-instances-in-same-machine-sharing-same-data-and-log-directory/183202>\
**Category:** Elasticsearch\
**Created:** [May 29, 2019, 1:06am UTC](https://discuss.elastic.co/t/multiple-jvm-instances-in-same-machine-sharing-same-data-and-log-directory/183202 "2019-05-29T01:06:34Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon17386273](https://avatars.discourse-cdn.com/v4/letter/a/d2c977/32.png) [@anon17386273](https://discuss.elastic.co/u/anon17386273)\
**Post date:** [May 29, 2019, 1:06am UTC](https://discuss.elastic.co/t/multiple-jvm-instances-in-same-machine-sharing-same-data-and-log-directory/183202/1 "2019-05-29T01:06:34Z")

</div>

I have a few powerful machines which is a bit of wasted to run only one instance of es. I was thinking of running multiple instances. Each of these machines have 12 SSD with JBOD configuration.  
I have mounted them as /data/1/, /data/2/.. and so on

My worry is whether multiple instances sharing same data directories would have any issue. Eg. Data corruption

path:  
data: /data/1/,/data/2/,/data/3/ ...  
logs: /var/log/elasticsearch

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [May 29, 2019, 1:10am UTC](https://discuss.elastic.co/t/multiple-jvm-instances-in-same-machine-sharing-same-data-and-log-directory/183202/2 "2019-05-29T01:10:45Z")

</div>

> [@anon17386273](#):
>
> My worry is whether multiple instances sharing same data directories would have any issue.

Yes, Elasticsearch will detect this and not run another instance using the same data directory.

Have you considered using containers?

---

<div class="post-metadata">

**Author:** ![anon17386273](https://avatars.discourse-cdn.com/v4/letter/a/d2c977/32.png) [@anon17386273](https://discuss.elastic.co/u/anon17386273)\
**Post date:** [May 29, 2019, 1:41am UTC](https://discuss.elastic.co/t/multiple-jvm-instances-in-same-machine-sharing-same-data-and-log-directory/183202/3 "2019-05-29T01:41:33Z")

</div>

I have included max\_local\_storage\_nodes in the config. Is this appropriate for production setup?

Also, my raid setup is JBOD. The purpose is to swap faulty SSD and maintain redundancy. Using docker containers, I would still be specifying volumes pointing to multiple data paths.  
Is there some other design that you have in mind for supporting multiple instances?

---

<div class="post-metadata">

**Author:** ![rjernst](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rjernst/32/6363_2.png) [@rjernst](https://discuss.elastic.co/u/rjernst)\
**Post date:** [May 31, 2019, 6:31am UTC](https://discuss.elastic.co/t/multiple-jvm-instances-in-same-machine-sharing-same-data-and-log-directory/183202/4 "2019-05-31T06:31:14Z")

</div>

`max_local_storage_nodes` is not recommended for production; you should use separate data directories for each instance of elasticsearch (meaning each instance needs its own config directory). Additionally, that setting is being deprecated in 7.x (see [https://github.com/elastic/elasticsearch/pull/42426](https://github.com/elastic/elasticsearch/pull/42426)).

---

<div class="post-metadata">

**Author:** ![anon17386273](https://avatars.discourse-cdn.com/v4/letter/a/d2c977/32.png) [@anon17386273](https://discuss.elastic.co/u/anon17386273)\
**Post date:** [May 31, 2019, 7:32am UTC](https://discuss.elastic.co/t/multiple-jvm-instances-in-same-machine-sharing-same-data-and-log-directory/183202/5 "2019-05-31T07:32:56Z")

</div>

Hi Ryan, thanks for the reply and info. I will allocate separate data directories for each instance.

For config directory, I am trying to "eliminate" the need to use the elasticsearch.yml for each instance by having each instance start up with the environment and variables.

Eg. Using systemd  
Environment="ES\_JAVA\_OPTS=-Xms1g Xmx1g"  
ExecStart=/opt/elasticsearch/bin/elasticsearch   
-Ecluster.name=production  
-Ecluster.initial\_master\_nodes=es01,es02,es03  
-Ediscovery.seed\_hosts=192.168.100.1,192.168.100.2,192.168.100.3  
-Enetwork.host=192.168.100.1  
-Ehttp.port=9200  
-Enode.name=es01  
-Epath.logs=/var/log/elasticsearch/es01  
-Epath.data=/data/es01

Seems that all the required settings can be placed in the service file and "eliminate" the need to use elasticsearch.yml.

Is there any caveat in doing this?

---

<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:** [June 28, 2019, 7:33am UTC](https://discuss.elastic.co/t/multiple-jvm-instances-in-same-machine-sharing-same-data-and-log-directory/183202/6 "2019-06-28T07:33:02Z")

</div>

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