# Java Transport Client Host Addresses

**URL:** <https://discuss.elastic.co/t/java-transport-client-host-addresses/102384>\
**Category:** Elasticsearch\
**Created:** [October 1, 2017, 5:31pm UTC](https://discuss.elastic.co/t/java-transport-client-host-addresses/102384 "2017-10-01T17:31:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gaurav\_Kumar1](https://avatars.discourse-cdn.com/v4/letter/g/bbe5ce/32.png) [@Gaurav\_Kumar1](https://discuss.elastic.co/u/Gaurav_Kumar1)\
**Post date:** [October 1, 2017, 5:31pm UTC](https://discuss.elastic.co/t/java-transport-client-host-addresses/102384/1 "2017-10-01T17:31:20Z")

</div>

Hi All,

We are having 15 machines ElasticSearch cluster of version 5.6.0, out of which only 5 machines are defined as master eligible and all 15 machines are defined as data nodes.

Now If we are using Java Transport Client as specified in [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) as below 👎  
`
TransportClient client = new PreBuiltTransportClient(Settings.EMPTY)
.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("host1"), 9300))
.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("host2"), 9300));
`

Then which nodes to be added in transport address in transport client??

Should we add only master eligible 5 nodes in client connection or all 15 data nodes need to be added in client connection?

---

<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 1, 2017, 6:32pm UTC](https://discuss.elastic.co/t/java-transport-client-host-addresses/102384/2 "2017-10-01T18:32:41Z")

</div>

Coordinating nodes should be defined here.

They can be master, data, none of them, whatever you prefer.

---

<div class="post-metadata">

**Author:** ![Gaurav\_Kumar1](https://avatars.discourse-cdn.com/v4/letter/g/bbe5ce/32.png) [@Gaurav\_Kumar1](https://discuss.elastic.co/u/Gaurav_Kumar1)\
**Post date:** [October 2, 2017, 10:45am UTC](https://discuss.elastic.co/t/java-transport-client-host-addresses/102384/3 "2017-10-02T10:45:30Z")

</div>

What is best practice to use? Currently I have defined only 5 data nodes in transport client. Should I define all 15 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:** [October 2, 2017, 11:32am UTC](https://discuss.elastic.co/t/java-transport-client-host-addresses/102384/4 "2017-10-02T11:32:50Z")

</div>

It basically means that you are going to add more load to the 5 data nodes than the others.  
I'd say it's up to you but ideally, I think that I'd create:

- 15 data nodes (`master: false`, `data: true`, `ingest: false`)
- 3 client nodes (`master: false`, `data: false`, `ingest: true`)
- 3 master nodes (`master: true`, `data: false`, `ingest: false`)

Then I'd set the 3 client nodes in the transport client (or the rest client).

If you can't afford that number of physical machines, you can collocate master nodes and client nodes on the same machine.  
How did you get that number of 15 data nodes? If it's just a random number, may be trying to decrease it to 12 and use the 3 remaining ones as master and client would be ok?

---

<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:** [October 30, 2017, 11:33am UTC](https://discuss.elastic.co/t/java-transport-client-host-addresses/102384/5 "2017-10-30T11:33:20Z")

</div>

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