# Elastic Load Balancer

**URL:** <https://discuss.elastic.co/t/elastic-load-balancer/358553>\
**Category:** Elasticsearch\
**Created:** [May 1, 2024, 11:21am UTC](https://discuss.elastic.co/t/elastic-load-balancer/358553 "2024-05-01T11:21:15Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![El-k](https://avatars.discourse-cdn.com/v4/letter/e/b5e925/32.png) [@El-k](https://discuss.elastic.co/u/El-k)\
**Post date:** [May 1, 2024, 11:21am UTC](https://discuss.elastic.co/t/elastic-load-balancer/358553/1 "2024-05-01T11:21:15Z")

</div>

Hi,  
I am new to elastic, trying to set up my cluster.  
I have 3 master nodes, 3 data nodes and 1 client node, each one of them runs on a different machine.

My question is, is there a default load balancer that gets the transport and sends it to the appropriate nodes?

If I want to send data to the cluster, to which address should I send it, as each data node has a different IP address?  
Do I have to use an external LB for that?

Sorry for the basic question... any help would be appreciated!

---

<div class="post-metadata">

**Author:** ![Sander\_Philipse](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sander_philipse/32/101890_2.png) [@Sander\_Philipse](https://discuss.elastic.co/u/Sander_Philipse)\
**Post date:** [May 1, 2024, 1:09pm UTC](https://discuss.elastic.co/t/elastic-load-balancer/358553/2 "2024-05-01T13:09:23Z")

</div>

Hi @El-k, Elasticsearch nodes will try to balance load naturally between themselves and you should not need to route requests to a specific node manually. Any node has the ability to effectively function as an internal load balancer across the cluster.

We do generally recommend that you don't route requests to a dedicated master node, as those nodes need to fulfil additional duties.

For more information, see:

> **[Search shard routing | Elasticsearch Guide \[8.13\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-shard-routing.html)**

---

<div class="post-metadata">

**Author:** ![El-k](https://avatars.discourse-cdn.com/v4/letter/e/b5e925/32.png) [@El-k](https://discuss.elastic.co/u/El-k)\
**Post date:** [May 5, 2024, 6:27am UTC](https://discuss.elastic.co/t/elastic-load-balancer/358553/3 "2024-05-05T06:27:11Z")

</div>

Thanks, @Sander_Philipse . Just to make sure I got it right:

Assuming that Elasticsearch nodes perform an internal load balancer,  
can I choose one random data-node IP address  
and always access the cluster endpoint using 'http://:9200/'?

Will the cluster then direct the request to the right node?

---

<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:** [May 5, 2024, 6:45am UTC](https://discuss.elastic.co/t/elastic-load-balancer/358553/4 "2024-05-05T06:45:42Z")

</div>

> [@El-k](#):
>
> Assuming that Elasticsearch nodes perform an internal load balancer,  
> can I choose one random data-node IP address  
> and always access the cluster endpoint using 'http://:9200/'?
> 
> Will the cluster then direct the request to the right node?

The node that receives the request will coordinate the execution. This will often involve multiple nodes in the cluster.

All official clients, including Beats and Logstash, support specifying a number of nodes in the connection string and will send requests to all nodes listed.

What you are proposing is bad for primarily 2 reasons:

- Coordinating a request is not free and adds load to the node. Having only a sinle node coordinating all requests can cause load imbalance and performance problems. Sometimes a number of dedicated coordinating only nodes are used as the entry point to the cluster, but that is generally not needed for small clusters.
- If the clients are only able to connect to one node that node is a single point of failure. If you need to restart it, e.g. due to an uprade, or it crashes the clients will experience an outage.

---

<div class="post-metadata">

**Author:** ![El-k](https://avatars.discourse-cdn.com/v4/letter/e/b5e925/32.png) [@El-k](https://discuss.elastic.co/u/El-k)\
**Post date:** [May 8, 2024, 5:28am UTC](https://discuss.elastic.co/t/elastic-load-balancer/358553/5 "2024-05-08T05:28:53Z")

</div>

Thanks, @Christian_Dahlqvist . This is the answer I was looking for!  
At the end, decided to create an internal LB to manage traffic to data nodes with health checks.

---

<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 5, 2024, 5:29am UTC](https://discuss.elastic.co/t/elastic-load-balancer/358553/6 "2024-06-05T05:29:16Z")

</div>

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