# Loadbalancer infromt of client nodes

**URL:** <https://discuss.elastic.co/t/loadbalancer-infromt-of-client-nodes/103463>\
**Category:** Elasticsearch\
**Created:** [October 11, 2017, 4:42am UTC](https://discuss.elastic.co/t/loadbalancer-infromt-of-client-nodes/103463 "2017-10-11T04:42:58Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![iam.Carrot](https://avatars.discourse-cdn.com/v4/letter/i/a9adbd/32.png) [@iam.Carrot](https://discuss.elastic.co/u/iam.Carrot)\
**Post date:** [October 11, 2017, 4:42am UTC](https://discuss.elastic.co/t/loadbalancer-infromt-of-client-nodes/103463/1 "2017-10-11T04:42:58Z")

</div>

Hi am running a 7 node architecture with 3 master nodes, 2 co-ordinate only (earlier known as client) and 2 data nodes.

I ab API to interact with my elastic cluster to provide data.

My question is, do I need to put a load balancer between the two client nodes. Because I read somewhere that the client nodes act as "smart load balancers" in the cluster themselves.

How do i ensure that the queries would be equally distributed over both my clients.  
While establishing the connection in the API, we have to pass in the `node.name` as well and I am setting it as the name of the first client node. And when i put the name of the domain instead, of the ip of the client node, then it gives me a `node not found exception`.

If I do have to use a loadbalancer, which load balancer should I be using `HTTP` or `TCP`?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [October 11, 2017, 5:52am UTC](https://discuss.elastic.co/t/loadbalancer-infromt-of-client-nodes/103463/2 "2017-10-11T05:52:21Z")

</div>

What is the jdbc driver you are using?

---

<div class="post-metadata">

**Author:** ![iam.Carrot](https://avatars.discourse-cdn.com/v4/letter/i/a9adbd/32.png) [@iam.Carrot](https://discuss.elastic.co/u/iam.Carrot)\
**Post date:** [October 11, 2017, 6:35am UTC](https://discuss.elastic.co/t/loadbalancer-infromt-of-client-nodes/103463/3 "2017-10-11T06:35:42Z")

</div>

@dadoonet I've updated the question I was wrong to put in the JDBC

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [October 11, 2017, 6:56am UTC](https://discuss.elastic.co/t/loadbalancer-infromt-of-client-nodes/103463/4 "2017-10-11T06:56:55Z")

</div>

What is the client you are using?

---

<div class="post-metadata">

**Author:** ![sudpaw](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sudpaw/32/39941_2.png) [@sudpaw](https://discuss.elastic.co/u/sudpaw)\
**Post date:** [October 11, 2017, 11:49am UTC](https://discuss.elastic.co/t/loadbalancer-infromt-of-client-nodes/103463/5 "2017-10-11T11:49:34Z")

</div>

I am wondering the same question.  
Setup:  
12 Data nodes.  
3 Master nodes.  
3 Coordinating nodes.  
ES version 5.6.2.

I am providing the client with a list of dns names of the coordinating nodes.  
However it seems like there is no real balance between the nodes - if i put high load on one coordinating node - by doing a big agg. other requests (which should then use the other nodes) is getting errors.

I am considering to change the order of node names for each client connected.

---

<div class="post-metadata">

**Author:** ![iam.Carrot](https://avatars.discourse-cdn.com/v4/letter/i/a9adbd/32.png) [@iam.Carrot](https://discuss.elastic.co/u/iam.Carrot)\
**Post date:** [October 11, 2017, 12:04pm UTC](https://discuss.elastic.co/t/loadbalancer-infromt-of-client-nodes/103463/6 "2017-10-11T12:04:09Z")

</div>

@dadoonet The client means the "coordinate only nodes". They used to be called client nodes before. If you mean how am I trying to interact with the client nodes, then I have a java API application that uses spring tcp connection to establish a connection to my cluster.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [October 11, 2017, 2:46pm UTC](https://discuss.elastic.co/t/loadbalancer-infromt-of-client-nodes/103463/7 "2017-10-11T14:46:35Z")

</div>

So Client nodes are part of the cluster. They know exactly where the shards are located on the cluster.

> do I need to put a load balancer between the two client nodes.

No.

Just give the list of the 2 client nodes to your client (the Java one you mentioned).

---

<div class="post-metadata">

**Author:** ![iam.Carrot](https://avatars.discourse-cdn.com/v4/letter/i/a9adbd/32.png) [@iam.Carrot](https://discuss.elastic.co/u/iam.Carrot)\
**Post date:** [October 11, 2017, 3:11pm UTC](https://discuss.elastic.co/t/loadbalancer-infromt-of-client-nodes/103463/8 "2017-10-11T15:11:17Z")

</div>

@dadoonet

> [@dadoonet](#):
>
> Just give the list of the 2 client nodes to your client (the Java one you mentioned).

I don't have a place for two client names below is the java code:

```
client = TransportClient.builder().settings(Settings.builder().put("cluster.name", "ates").put("node.name","ates-client-01")).build();

```

where I put in the client name and there is no way I can put in multiple node names.

When you say, list the 2 client nodes in java, where exactly do you mean?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [October 11, 2017, 3:24pm UTC](https://discuss.elastic.co/t/loadbalancer-infromt-of-client-nodes/103463/9 "2017-10-11T15:24:45Z")

</div>

That's a wrong usage of the transport client.

Look at the doc: [https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/transport-client.html](https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/transport-client.html)

```auto
TransportClient client = new PreBuiltTransportClient(Settings.EMPTY)
        .addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("host1"), 9300))
        .addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("host2"), 9300));

```

That's all what you need here.

May be add `client.transport.ignore_cluster_name` in the settings or the cluster name if you wish but that's all.

---

<div class="post-metadata">

**Author:** ![iam.Carrot](https://avatars.discourse-cdn.com/v4/letter/i/a9adbd/32.png) [@iam.Carrot](https://discuss.elastic.co/u/iam.Carrot)\
**Post date:** [October 11, 2017, 3:49pm UTC](https://discuss.elastic.co/t/loadbalancer-infromt-of-client-nodes/103463/10 "2017-10-11T15:49:41Z")

</div>

@dadoonet great I'll try it and get back. Thanks for the help. The getting back will take a while as it's midnight here. but I'll try it first thing in the morning

---

<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:** [November 8, 2017, 3:50pm UTC](https://discuss.elastic.co/t/loadbalancer-infromt-of-client-nodes/103463/11 "2017-11-08T15:50:19Z")

</div>

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