Load balancing using Transport Client


(Navneet Mathpal) #1

Hi ,

I am using elastic 1.7.1 . Sending the data in elasticsearch through java I am using Transport client .
I have three nodes which are running .
so I am listing all the three nodes to Transport client like

Settings settings = ImmutableSettings.settingsBuilder().put("client.transport.sniff", true).put("cluster.name",clusterName).build();

TransportClient client = new TransportClient(settings).addTransportAddress(new InetSocketTransportAddress(host1, port)).addTransportAddress(new InetSocketTransportAddress(host2 , port)).addTransportAddress(new InetSocketTransportAddress(host3, port));

If any nodes goes down it shows me exception that - Exception caught on transport layer , closing connection.
Is there any way that if any nodes goes down , elasticsearch will consider two nodes which are currently running without showing any exception/error.
My requirement is the same as we do in logstash .. we listed down multiple hosts => [host1,host2,host3]
if host1 goes down logstash will start pushing the data in another host which are currently available..

Any idea how to achive the same using transport client ?

Thanks


(system) #2