Transport client and coordinating nodes

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?

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

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?

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?

You can. You are not force to.

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

1 Like

Thanks a lot , Appreciate it

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