# Transport client and coordinating nodes

**URL:** <https://discuss.elastic.co/t/transport-client-and-coordinating-nodes/89123>\
**Category:** Elasticsearch\
**Created:** [June 12, 2017, 11:01pm UTC](https://discuss.elastic.co/t/transport-client-and-coordinating-nodes/89123 "2017-06-12T23:01:59Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![samdash](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/samdash/32/21628_2.png) [@samdash](https://discuss.elastic.co/u/samdash)\
**Post date:** [June 12, 2017, 11:01pm UTC](https://discuss.elastic.co/t/transport-client-and-coordinating-nodes/89123/1 "2017-06-12T23:01:59Z")

</div>

I am currently using Transport client ( java) , and I have 3 node setup with master and date = true.  
and in my java client i am adding all 3 nodes using addTransportAddress

My first question is do i need to add all the 3 nodes ? If so What if I increase this 3 nodes setup to say 7 or 9 nodes with dedicated 3 master nodes, in that case also do i have to add all 9 nodes in my java transport client?

Does master node act as coordinating nodes?

---

<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:** [June 13, 2017, 8:29am UTC](https://discuss.elastic.co/t/transport-client-and-coordinating-nodes/89123/2 "2017-06-13T08:29:48Z")

</div>

> do i need to add all the 3 nodes ?

No. You must add at least one. If you don't activate sniffing, then only this single node will be used to query your cluster.  
If you add the 3 nodes then all of them will be used. Which is safer IMO as one of the other nodes can fail at some point.

If you increase the number of nodes in your cluster, only the nodes you defined will be used. Then you can decide if you want to send the Client traffic to more nodes or not.

The node that gets a query is known as the coordinating node. It can be any node in the cluster whatever his role.

A nice practice for "big" clusters is to have 3 dedicated master only nodes (data: false, ingest: false, master: true), 2 or more coordinating nodes (master: false, data: false) and data nodes (master: false, ingest: false) and if needed ingest only nodes (data: false, ingest: true, master: false).

HTH

---

<div class="post-metadata">

**Author:** ![samdash](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/samdash/32/21628_2.png) [@samdash](https://discuss.elastic.co/u/samdash)\
**Post date:** [June 13, 2017, 4:15pm UTC](https://discuss.elastic.co/t/transport-client-and-coordinating-nodes/89123/3 "2017-06-13T16:15:21Z")

</div>

```
Settings settings = Settings.builder()
    		        .put(CDSElasticConstants.CLUSTER_NAME, CLUSTER_NAME)
    		        .put("client.transport.sniff", "true")
    		        .build();

transportClient = new PreBuiltTransportClient(settings);
transportClient.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(ELASTIC_SERVER_HOST), ELASTIC_SERVER_PORT));

```

Above is the sample code, now if i have big cluster do i have to add all the servers/hosts? something like below

```
    transportClient = new PreBuiltTransportClient(settings);
    transportClient.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(ELASTIC_SERVER_HOST), ELASTIC_SERVER_PORT));
    transportClient.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(ELASTIC_SERVER_HOST1), ELASTIC_SERVER_PORT1));
    transportClient.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(ELASTIC_SERVER_HOST2), ELASTIC_SERVER_PORT2));
   transportClient.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(ELASTIC_SERVER_HOST3), ELASTIC_SERVER_PORT3));
   transportClient.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(ELASTIC_SERVER_HOST4), ELASTIC_SERVER_PORT4)); 
    transportClient.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(ELASTIC_SERVER_HOST5), ELASTIC_SERVER_PORT5));

```

and so on. Also like you mentioned do i need to have coordinating nodes , if i am using Transport Client?

---

<div class="post-metadata">

**Author:** ![samdash](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/samdash/32/21628_2.png) [@samdash](https://discuss.elastic.co/u/samdash)\
**Post date:** [June 13, 2017, 4:21pm UTC](https://discuss.elastic.co/t/transport-client-and-coordinating-nodes/89123/4 "2017-06-13T16:21:18Z")

</div>

> [@dadoonet](#):
>
> only the nodes you defined will be used.

Also what does this mean? Only the nodes you defined? do i need to add only coordinating nodes in my transport client? i am not planning to have any coordinating nodes just Master nodes and data nodes, is this fine? IF so should i add only master nodes in my client or just data nodes or both?

---

<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:** [June 13, 2017, 11:01pm UTC](https://discuss.elastic.co/t/transport-client-and-coordinating-nodes/89123/5 "2017-06-13T23:01:08Z")

</div>

> [@samdash](#):
>
> do i have to add all the servers/hosts?

You can. You are not force to.

> [@samdash](#):
>
> do i need to have coordinating nodes

If you meant "dedicated coordinating nodes", no. It's not mandatory.

> Only the nodes you defined?

The nodes that you add with `addTransportAddress()`.

> If so should i add only master nodes in my client or just data nodes or both?

As you wish. If you add only master nodes, then the queries will be launched to all shards from the master eligible node which is getting the request from the Transport Client.

If you add only data nodes, then you will add some additional memory pressure on the data nodes but that can be perfectly fine.

To sum up, if your master nodes have enough memory, might be preferable to only add them to the list.

My 2 cents

---

<div class="post-metadata">

**Author:** ![samdash](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/samdash/32/21628_2.png) [@samdash](https://discuss.elastic.co/u/samdash)\
**Post date:** [June 14, 2017, 4:00pm UTC](https://discuss.elastic.co/t/transport-client-and-coordinating-nodes/89123/6 "2017-06-14T16:00:37Z")

</div>

Thanks a lot , Appreciate it

---

<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 12, 2017, 4:00pm UTC](https://discuss.elastic.co/t/transport-client-and-coordinating-nodes/89123/7 "2017-07-12T16:00:46Z")

</div>

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