Hi,
for testing purposes, I've started up a stand-alone Elasticsearch node on
my laptop, and am using the transport client to connect to it. When I
initialize the client using "sniff=true", and then print out the list of
connected nodes, as follows:
TransportClient client = new TransportClient(
ImmutableSettings.builder()
.put("client.transport.ignore_cluster_name",true)
.put("client.transport.sniff",true)
);
client.addTransportAddress(new
InetSocketTransportAddress("192.168.1.5",9300));
for(DiscoveryNode node: client.connectedNodes()) {
System.out.println(node);
}
I get two nodes in the output:
[#transport#-1][Stefans-MacBook-Pro.local][inet[/192.168.1.5:9300]]
[Diablo][15AyTluTS4Wj26tKgkyQDA][Stefans-MacBook-Pro.local][inet[/192.168.1.5:9300]]
These are the same node listed twice, presumably once as the node that I
added via "addTransportAddress()", and once as sniffed out by the sniffer.
You can tell that the latter one is more detailed, and includes the actual
node id and name, while the former is just the basic network information.
Notice also that they both refer to the same IP and port combination.
When I run the same test, but with sniff=false, I get one node, but
somewhat surprisingly, the generic "transport" node has been dropped from
the list:
[Diablo][15AyTluTS4Wj26tKgkyQDA][Stefans-MacBook-Pro.local][inet[/192.168.1.5:9300]]
I this the expected behavior ? Why does the sniffer not simply replace
the node info like the client does with sniff=false ? Why does it
essentially leave the node in there twice, apparently ignoring the fact
that there are two entries with the exact same connection info ?
I looked at the code, and apparently it dedupes nodes based on ID, which in
this case are obviously different (#transport#-1
vs 15AyTluTS4Wj26tKgkyQDA), but ignores the fact that the IP and port are
identical.
My expectation was that with sniff=true, it would replace the initial with
the one sniffed from the cluster, and then add any additional nodes it has
discovered, but in reality, I end up with 2x the nodes when I add my entire
cluster via addTransportAddress().
Thanks,
Stefan
--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/0f7ca562-8a91-469f-98d3-08e8a27d4ea1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.