Hosting multiple ES instances on one host

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

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. :slight_smile:

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.

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.

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?

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

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?

You may be thinking about [allocation filtering] (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 :slight_smile:

Thanks

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 :slight_smile: )