# Hosting multiple ES instances on one host

**URL:** https://discuss.elastic.co/t/hosting-multiple-es-instances-on-one-host/60557
**Category:** Elasticsearch
**Created:** [September 14, 2016, 11:25pm UTC](https://discuss.elastic.co/t/hosting-multiple-es-instances-on-one-host/60557 "2016-09-14T23:25:15Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![stecino](https://avatars.discourse-cdn.com/v4/letter/s/ea666f/32.png) [@stecino](https://discuss.elastic.co/u/stecino)
#### Post date: [September 14, 2016, 11:25pm UTC](https://discuss.elastic.co/t/hosting-multiple-es-instances-on-one-host/60557/1 "2016-09-14T23:25:15Z")

</div>

Hello,

I want to run 2 instances of ES where each instance is going to be member of a different cluster.  
I have enough resources on it. What I wanted to know is how I should deploy it:

Version 1:

where all settings are encapsulated in a separate install directory  
/opt/elasticsearch\_1  
/opt/elastiicsearch\_2

Version 2:

shared installed directory with separation at the config level  
/opt/elasticsearch/confg  
.. elasticsearch1.yml  
.. elasticsearch2.yml

Thanks in advance

---

<div class="post-metadata">

### Author: ![polyfractal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/polyfractal/32/48162_2.png) [@polyfractal](https://discuss.elastic.co/u/polyfractal)
#### Post date: [September 15, 2016, 4:19pm UTC](https://discuss.elastic.co/t/hosting-multiple-es-instances-on-one-host/60557/2 "2016-09-15T16:19:44Z")

</div>

Up to your preferences, really. They are functionally identical. If you have two clusters sharing the same directory (with different configs), all the data/metadata/etc will be segregated under `data/cluster1` and `data/cluster2`.

So it's really just whichever you like, or whichever is easier for you to manage, etc. 🙂

---

<div class="post-metadata">

### Author: ![stecino](https://avatars.discourse-cdn.com/v4/letter/s/ea666f/32.png) [@stecino](https://discuss.elastic.co/u/stecino)
#### Post date: [September 15, 2016, 5:17pm UTC](https://discuss.elastic.co/t/hosting-multiple-es-instances-on-one-host/60557/3 "2016-09-15T17:17:47Z")

</div>

Thanks!! Probably the only tricky part of having multiple yaml files in a single installation directory is the init script. Will need to explicitly pass in the yaml file I want to load for that particular instance and everything else associated to it with separate pid files.

---

<div class="post-metadata">

### Author: ![polyfractal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/polyfractal/32/48162_2.png) [@polyfractal](https://discuss.elastic.co/u/polyfractal)
#### Post date: [September 15, 2016, 5:50pm UTC](https://discuss.elastic.co/t/hosting-multiple-es-instances-on-one-host/60557/4 "2016-09-15T17:50:07Z")

</div>

Yeah, agreed. If it were me, I'd personally prefer to keep them separate just because I think it'd be a bit easier to manage, and less likely to accidentally mess up (e.g. spin up a node but give it the wrong config).

It also makes things like static scripts a little easier to manage, now that I think about it. Each would have their own script folder, instead of sharing them.

---

<div class="post-metadata">

### Author: ![stecino](https://avatars.discourse-cdn.com/v4/letter/s/ea666f/32.png) [@stecino](https://discuss.elastic.co/u/stecino)
#### Post date: [September 15, 2016, 6:40pm UTC](https://discuss.elastic.co/t/hosting-multiple-es-instances-on-one-host/60557/5 "2016-09-15T18:40:06Z")

</div>

I probably go that way also. One thing wanted to ask in regards config. Do you know what node.server stand for? Is it host that will hold all the nodes?

---

<div class="post-metadata">

### Author: ![polyfractal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/polyfractal/32/48162_2.png) [@polyfractal](https://discuss.elastic.co/u/polyfractal)
#### Post date: [September 15, 2016, 6:59pm UTC](https://discuss.elastic.co/t/hosting-multiple-es-instances-on-one-host/60557/6 "2016-09-15T18:59:43Z")

</div>

Hm, I'm not familiar with that config setting? Where did you see it?

---

<div class="post-metadata">

### Author: ![stecino](https://avatars.discourse-cdn.com/v4/letter/s/ea666f/32.png) [@stecino](https://discuss.elastic.co/u/stecino)
#### Post date: [September 15, 2016, 7:02pm UTC](https://discuss.elastic.co/t/hosting-multiple-es-instances-on-one-host/60557/7 "2016-09-15T19:02:08Z")

</div>

Could have been in the earlier ES versions, at the elasticON someone presented multiple nodes running on the one host and this was one of the settings. Or is it node.rack? How do I present them as separate nodes on the host?

---

<div class="post-metadata">

### Author: ![polyfractal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/polyfractal/32/48162_2.png) [@polyfractal](https://discuss.elastic.co/u/polyfractal)
#### Post date: [September 15, 2016, 7:47pm UTC](https://discuss.elastic.co/t/hosting-multiple-es-instances-on-one-host/60557/8 "2016-09-15T19:47:16Z")

</div>

You may be thinking about [allocation filtering] ([https://www.elastic.co/guide/en/elasticsearch/reference/current/shard-allocation-filtering.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/shard-allocation-filtering.html)), which uses tags like "node.rack". But that's for controlling where shards are allocated.

Each individual JVM that is running will be it's own node, nothing special needs to be done. So if you execute `./bin/elasticsearch` twice (with same or different config, or entirely different directories), you'll have two ES nodes running on that machine.

What you may be remembering is that shard filtering can be useful if you have two nodes on the same machine _in the same cluster._ In that case, you may want to setup zones so that primaries/replicas don't land on the same physical machine (but on two different nodes... that just happen to be on one machine).

But since you're running two entirely separate clusters, you don't have to worry about those kinds of things 🙂

---

<div class="post-metadata">

### Author: ![stecino](https://avatars.discourse-cdn.com/v4/letter/s/ea666f/32.png) [@stecino](https://discuss.elastic.co/u/stecino)
#### Post date: [September 15, 2016, 9:26pm UTC](https://discuss.elastic.co/t/hosting-multiple-es-instances-on-one-host/60557/9 "2016-09-15T21:26:00Z")

</div>

Thanks

---

<div class="post-metadata">

### Author: ![polyfractal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/polyfractal/32/48162_2.png) [@polyfractal](https://discuss.elastic.co/u/polyfractal)
#### Post date: [September 15, 2016, 10:07pm UTC](https://discuss.elastic.co/t/hosting-multiple-es-instances-on-one-host/60557/10 "2016-09-15T22:07:50Z")

</div>

You'll need different master nodes (e.g. running JVM instances of ES) for each cluster. A node can only belong to one cluster at a time, so you'll need a different set for each cluster.

The two different sets of master nodes can reside on the same physical machines if you want though. Dedicated master nodes are usually very resource-light, so you could easily put two of them on the same machine, each managing different clusters.

If you have three masters per cluster, you'll still want to keep those on separate machines (the redundancy of multiple master nodes doesn't help if they are all on one physical machine 🙂 )

---

<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, 10:19pm UTC](https://discuss.elastic.co/t/hosting-multiple-es-instances-on-one-host/60557/11 "2017-07-05T22:19:53Z")

</div>


