# Fault tolerance "address" for ES Cluster

**URL:** <https://discuss.elastic.co/t/fault-tolerance-address-for-es-cluster/27268>\
**Category:** Elasticsearch\
**Created:** [August 12, 2015, 3:04pm UTC](https://discuss.elastic.co/t/fault-tolerance-address-for-es-cluster/27268 "2015-08-12T15:04:17Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![tickermcse76](https://avatars.discourse-cdn.com/v4/letter/t/d6d6ee/32.png) [@tickermcse76](https://discuss.elastic.co/u/tickermcse76)\
**Post date:** [August 12, 2015, 3:04pm UTC](https://discuss.elastic.co/t/fault-tolerance-address-for-es-cluster/27268/1 "2015-08-12T15:04:17Z")

</div>

Suppose I have 5 ES nodes in a cluster; call them ES1, ES2, ES3, ES4, and ES5. I also have a farm of 20 web servers (call them W01 to W20) that need to point to this cluster. What address should the web servers point to such that if any 1 or 2 of the ES nodes goes down the web servers can be serviced by one of the remaining 3 or 4 ES nodes that are still active?

Example; suppose the configuration is to have W01-W05 point to ES1.... W15-W20 point to ES5. But in the event that ES5 goes down, W15-W20 would not be directed to the other nodes. How can the environment be configured such that W15-W20 could be directed to ES1-ES4 in the event ES5 fails or is taken offline?

---

<div class="post-metadata">

**Author:** ![nirmalc](https://avatars.discourse-cdn.com/v4/letter/n/ecae2f/32.png) [@nirmalc](https://discuss.elastic.co/u/nirmalc)\
**Post date:** [August 12, 2015, 4:48pm UTC](https://discuss.elastic.co/t/fault-tolerance-address-for-es-cluster/27268/2 "2015-08-12T16:48:54Z")

</div>

You can point to any node in cluster. I would have few client only nodes in cluster and have webservers connect randomly to one of client only nodes ( optional ) . And yes - you could retry another node in case one of the node is not reachable.

Thanks  
Nirmal

---

<div class="post-metadata">

**Author:** ![tickermcse76](https://avatars.discourse-cdn.com/v4/letter/t/d6d6ee/32.png) [@tickermcse76](https://discuss.elastic.co/u/tickermcse76)\
**Post date:** [August 12, 2015, 7:08pm UTC](https://discuss.elastic.co/t/fault-tolerance-address-for-es-cluster/27268/3 "2015-08-12T19:08:35Z")

</div>

nirmalc - Thanks for your reply.

Randomly connecting to a node does not solve the issue of potentially landing on a node that could be offline/unavailable. So the solution would be to build a retry function into my application? While that might "work" it seems a poor solution for a production environment where performance is critical.

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [August 12, 2015, 7:17pm UTC](https://discuss.elastic.co/t/fault-tolerance-address-for-es-cluster/27268/4 "2015-08-12T19:17:58Z")

</div>

Use HAProxy or similar to front your ES machines, probe machines to discover when they're down, and deflect traffic away from unavailable nodes.

---

<div class="post-metadata">

**Author:** ![colings86](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/colings86/32/44960_2.png) [@colings86](https://discuss.elastic.co/u/colings86)\
**Post date:** [August 13, 2015, 7:36am UTC](https://discuss.elastic.co/t/fault-tolerance-address-for-es-cluster/27268/5 "2015-08-13T07:36:55Z")

</div>

Or use one of the official language clients. The language clients all monitor the nodes for you to detect when nodes become unavailable and route their requests to another node in the cluster

---

<div class="post-metadata">

**Author:** ![mosiddi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mosiddi/32/577_2.png) [@mosiddi](https://discuss.elastic.co/u/mosiddi)\
**Post date:** [August 14, 2015, 12:04pm UTC](https://discuss.elastic.co/t/fault-tolerance-address-for-es-cluster/27268/6 "2015-08-14T12:04:59Z")

</div>

We have our caller code in .NET and this client [[http://nest.azurewebsites.net/](http://nest.azurewebsites.net/)] does the load balancing / fault tolerance well.

---

<div class="post-metadata">

**Author:** ![tickermcse76](https://avatars.discourse-cdn.com/v4/letter/t/d6d6ee/32.png) [@tickermcse76](https://discuss.elastic.co/u/tickermcse76)\
**Post date:** [August 26, 2015, 5:07pm UTC](https://discuss.elastic.co/t/fault-tolerance-address-for-es-cluster/27268/7 "2015-08-26T17:07:00Z")

</div>

I reviewed the [Elasticsearch.Net](http://Elasticsearch.Net) client as an example.

[http://nest.azurewebsites.net/elasticsearch-net/connecting.html](http://nest.azurewebsites.net/elasticsearch-net/connecting.html)

> Here instead of directly passing node, we pass a SniffingConnectionPool which will use our node to find out the rest of the available cluster nodes

> var node = new Uri("[http://mynode.example.com:8082/apiKey](http://mynode.example.com:8082/apiKey)");  
> var connectionPool = new SniffingConnectionPool(new { node });  
> var config = new ConnectionConfiguration(connectionPool);  
> var client = new ElasticsearchClient(config);

Since "SniffingConnectionPool" still uses the defined "node" to discover the rest of the cluster, that still appears to be a single point of failure. In their example if [http://mynode.example.com:8082](http://mynode.example.com:8082) is unavailable, you will not have knowledge of other nodes in the cluster that may be available.

---

<div class="post-metadata">

**Author:** ![tickermcse76](https://avatars.discourse-cdn.com/v4/letter/t/d6d6ee/32.png) [@tickermcse76](https://discuss.elastic.co/u/tickermcse76)\
**Post date:** [August 26, 2015, 5:46pm UTC](https://discuss.elastic.co/t/fault-tolerance-address-for-es-cluster/27268/8 "2015-08-26T17:46:16Z")

</div>

[http://nest.azurewebsites.net/elasticsearch-net/cluster-failover.html](http://nest.azurewebsites.net/elasticsearch-net/cluster-failover.html)

According to that link, the SniffingConnectionPool setting will query the seedURIs you provide; and not the "node". This will work, but the way I interpreted this page and other are conflicting.

> SniffingConnectionPool

> This IConnectionPool implementation will sniff the cluster state on the passed seed nodes to find all the alive nodes in the cluster. It will round robin requests over all the alive nodes it knows about.  
> var pool = new SniffingConnectionPool(seedUris);

---

<div class="post-metadata">

**Author:** ![Ankit\_Singhal](https://avatars.discourse-cdn.com/v4/letter/a/ecb155/32.png) [@Ankit\_Singhal](https://discuss.elastic.co/u/Ankit_Singhal)\
**Post date:** [July 7, 2016, 1:31am UTC](https://discuss.elastic.co/t/fault-tolerance-address-for-es-cluster/27268/9 "2016-07-07T01:31:57Z")

</div>

Hi @magnusbaeck.. Is there any tutorial available for configuring HAProxy in front of Elastic machines?

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [July 7, 2016, 5:36am UTC](https://discuss.elastic.co/t/fault-tolerance-address-for-es-cluster/27268/10 "2016-07-07T05:36:34Z")

</div>

> Is there any tutorial available for configuring HAProxy in front of Elastic machines?

None that I know of but any HAProxy material should do. I doubt Elasticsearch is so special it warrants any specific documentation.

Please create your own thread for any follow-up questions.

---

<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:37pm UTC](https://discuss.elastic.co/t/fault-tolerance-address-for-es-cluster/27268/11 "2017-07-05T22:37:27Z")

</div>


