Adding downsides for the embedded node client

Note: this is being committed to the 1.6 and 1.7 branches.
This commit is contained in:
Chris Earle 2015-07-30 21:46:42 -05:00 committed by Chris Earle
parent 5a8356c86e
commit 87117a5b71
1 changed files with 19 additions and 3 deletions

View File

@ -90,7 +90,14 @@ import static org.elasticsearch.node.NodeBuilder.*;
// on startup // on startup
Node node = nodeBuilder().client(true).node(); // Embedded node clients behave just like standalone nodes,
// which means that they will leave the HTTP port open!
Node node =
nodeBuilder()
.settings(ImmutableSettings.settingsBuilder().put("http.enabled", false))
.client(true)
.node();
Client client = node.client(); Client client = node.client();
// on shutdown // on shutdown
@ -120,11 +127,21 @@ Client client = node.client();
node.close(); node.close();
-------------------------------------------------- --------------------------------------------------
[[node-client-downsides]]
==== Node Client Downsides
Embedding a node client into your application is the easiest way to connect
to an Elasticsearch cluster, but it carries some downsides.
- Frequently starting and stopping one or more node clients creates unnecessary
noise across the cluster.
- Embedded node client will respond to outside requests, just like any other client.
** You almost always want to disable HTTP for an _embedded_ node client.
[[transport-client]] [[transport-client]]
=== Transport Client === Transport Client
The `TransportClient` connects remotely to an elasticsearch cluster The `TransportClient` connects remotely to an Elasticsearch cluster
using the transport module. It does not join the cluster, but simply using the transport module. It does not join the cluster, but simply
gets one or more initial transport addresses and communicates with them gets one or more initial transport addresses and communicates with them
in round robin fashion on each action (though most actions will probably in round robin fashion on each action (though most actions will probably
@ -183,4 +200,3 @@ from a node. Defaults to `5s`.
|`client.transport.nodes_sampler_interval` |How often to sample / ping |`client.transport.nodes_sampler_interval` |How often to sample / ping
the nodes listed and connected. Defaults to `5s`. the nodes listed and connected. Defaults to `5s`.
|======================================================================= |=======================================================================