Java Transport Client Host Addresses

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 as below :-1:

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?

1 Like

Coordinating nodes should be defined here.

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

What is best practice to use? Currently I have defined only 5 data nodes in transport client. Should I define all 15 nodes?

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?

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