Improved transport sniffing docs

Closes #15204
This commit is contained in:
Andrew Cholakian 2015-12-02 18:01:52 -06:00 committed by Clinton Gormley
parent 4219f8e062
commit b8db32b7fd
1 changed files with 17 additions and 5 deletions

View File

@ -57,11 +57,23 @@ Client client = TransportClient.builder().settings(settings).build();
//Add transport addresses and do something with the client... //Add transport addresses and do something with the client...
-------------------------------------------------- --------------------------------------------------
The client allows sniffing the rest of the cluster, which adds data nodes The Transport client comes with a cluster sniffing feature which
into its list of machines to use. In this case, note that the IP addresses allows it to dynamically add new hosts and remove old ones.
used will be the ones that the other nodes were started with (the When sniffing is enabled the the transport client will connect to the nodes in its
"publish" address). In order to enable it, set the internal node list, which is built via calls to addTransportAddress.
`client.transport.sniff` to `true`: After this, the client will call the internal cluster state API on those nodes
to discover available data nodes. The internal node list of the client will
be replaced with those data nodes only. This list is refreshed every five seconds by default.
Note that the IP addresses the sniffer connects to are the ones declared as the 'publish'
address in those node's elasticsearch config.
Keep in mind that list might possibly not include the original node it connected to
if that node is not a data node. If, for instance, you initially connect to a
master node, after sniffing no further requests will go to that master node,
but rather to any data nodes instead. The reason the transport excludes non-data
nodes is to avoid sending search traffic to master only nodes.
In order to enable sniffing, set `client.transport.sniff` to `true`:
[source,java] [source,java]
-------------------------------------------------- --------------------------------------------------