# Setting up a basic high availability cluster

**URL:** <https://discuss.elastic.co/t/setting-up-a-basic-high-availability-cluster/145206>\
**Category:** Elasticsearch\
**Created:** [August 20, 2018, 4:19pm UTC](https://discuss.elastic.co/t/setting-up-a-basic-high-availability-cluster/145206 "2018-08-20T16:19:03Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![tim2](https://avatars.discourse-cdn.com/v4/letter/t/b782af/32.png) [@tim2](https://discuss.elastic.co/u/tim2)\
**Post date:** [August 20, 2018, 4:19pm UTC](https://discuss.elastic.co/t/setting-up-a-basic-high-availability-cluster/145206/1 "2018-08-20T16:19:03Z")

</div>

Im planning to set up a high availability cluster with 2 physical host machines hosting a number of VMs / elasticsearch nodes

How many nodes do I need on each host machine so that I can safely restart a host machine and keep everything operational? data integrity is crucial, can't lose any data

Would this work? 2 nodes on each host machine  
Host A: node 1, node 2  
Host B: node 3, node 4

or is this no different than having 1 node per host?

or is there a better config for the cluster?

Thanks

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [August 20, 2018, 5:18pm UTC](https://discuss.elastic.co/t/setting-up-a-basic-high-availability-cluster/145206/2 "2018-08-20T17:18:17Z")

</div>

To set up a highly available cluster you need a minimum of 3 hosts so that you can reach a majority even with 1 host unavailable.

---

<div class="post-metadata">

**Author:** ![tim2](https://avatars.discourse-cdn.com/v4/letter/t/b782af/32.png) [@tim2](https://discuss.elastic.co/u/tim2)\
**Post date:** [August 20, 2018, 5:29pm UTC](https://discuss.elastic.co/t/setting-up-a-basic-high-availability-cluster/145206/3 "2018-08-20T17:29:34Z")

</div>

would having 3 hosts guarantee no data loss when restarting 1 host machine at a time? (eg: OS updates)

should the number of hosts always be an odd number? eg: 3,5,7?

does elasticsearch distribute the workload based on available host resources (eg: cpu usage, disk performance)? or is it random?

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [August 20, 2018, 5:54pm UTC](https://discuss.elastic.co/t/setting-up-a-basic-high-availability-cluster/145206/4 "2018-08-20T17:54:42Z")

</div>

> [@tim2](#):
>
> would having 3 hosts guarantee no data loss when restarting 1 host machine at a time? (eg: OS updates)

Yes, assuming that you have at least one replica configured for all indices.

> [@tim2](#):
>
> should the number of hosts always be an odd number? eg: 3,5,7?

No, but you need a minimum of 3 master-eligible nodes on separate hosts.

> [@tim2](#):
>
> does elasticsearch distribute the workload based on available host resources (eg: cpu usage, disk performance)? or is it random?

The cluster handles the load and any request can be sent to any node. Exactly how load is distributed is however a large topic.

---

<div class="post-metadata">

**Author:** ![tim2](https://avatars.discourse-cdn.com/v4/letter/t/b782af/32.png) [@tim2](https://discuss.elastic.co/u/tim2)\
**Post date:** [August 20, 2018, 6:20pm UTC](https://discuss.elastic.co/t/setting-up-a-basic-high-availability-cluster/145206/5 "2018-08-20T18:20:58Z")

</div>

> Yes, assuming that you have at least one replica configured for all indices.

so basically I just need to set up a cluster with 3 nodes on 3 separate hosts with the default settings for primary and replica shards? and elasticsearch will automatically manage the shards, etc.?

> The cluster handles the load and any request can be sent to any node. Exactly how load is distributed is however a large topic.

when running a request (index or search), does it have to be sent to the current master node or any node in the cluster is fine? does the client need to know the IPs of all the nodes?  
or any node IP will work, but it's good to know all in case of connection failure?

thanks

---

<div class="post-metadata">

**Author:** ![chandra0651](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chandra0651/32/30484_2.png) [@chandra0651](https://discuss.elastic.co/u/chandra0651)\
**Post date:** [August 20, 2018, 7:07pm UTC](https://discuss.elastic.co/t/setting-up-a-basic-high-availability-cluster/145206/6 "2018-08-20T19:07:36Z")

</div>

so basically I just need to set up a cluster with 3 nodes on 3 separate hosts with the default settings for primary and replica shards? and elasticsearch will automatically manage the shards, etc.?

`

> For 3 node cluster the best suggested settings for index should some thing be like 3 primary and one replica which can handle the failure of one host.

`

---

<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:** [September 17, 2018, 7:07pm UTC](https://discuss.elastic.co/t/setting-up-a-basic-high-availability-cluster/145206/7 "2018-09-17T19:07:39Z")

</div>

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