Hello,
I'm in the process of moving away from the REST API to the JAVA one
(because we want to benefit from the data-less node advantages).
I tried to startup the local node in this way (boot seems fine to me):
String localhostname = java.net.InetAddress.getLocalHost().getHostName();
ImmutableSettings.Builder settings =
ImmutableSettings.settingsBuilder();
settings.put("cluster.name", clusterName);
//Node name
settings.put("node.name", localhostname + "-eslocalnode");
//This is key to configure a data less node
/*
# 3. You want this node to be neither master nor data node, but
# to act as a "search load balancer" (fetching data from nodes,
# aggregating results, etc.)
#
# node.master: false
# node.data: false
*/
settings.put("node.master", false);
settings.put("node.data", true);
/*
# By default, multiple nodes are allowed to start from the same
installation location
# to disable it, set the following:
# node.max_local_storage_nodes: 1
*/
settings.put("node.max_local_storage_nodes", 1);
/*
# Set a custom port for the node to node communication (9300 by
default):
#
# transport.tcp.port: 9300
*/
if (tcpPort > 0)
settings.put("transport.tcp.port", tcpPort);
else
throw new IllegalArgumentException("tcpPort is not set");
/*
# Disable HTTP completely:
#
# http.enabled: false
I don't want the HTTP api to be available on the local data-less
nodes, so I disable it
*/
settings.put("http.enabled", false);
/**
*
* DISCOVERY PART!!!
*
*
*
*/
settings.put("discovery.zen.ping.timeout", discoveryPingTimeout);
String unicastHostsArr[] = discoveryUnicastHosts.split("\\s*,\\s*");
if (unicastHostsArr.length > 0)
settings.put("discovery.zen.ping.unicast.hosts",
unicastHostsArr);
settings.put("discovery.zen.ping.multicast.enabled", false);
Settings esSettings = settings.build();
Node newNode =
NodeBuilder.nodeBuilder().local(true).settings(esSettings).node();
node = newNode.start();
(all variables are properly initialized I checked it). In particular, the
unicastHosts are just one host that is our dev server (and it is filled
with significant data) and the cluster name is the same.
Anyway if I attempt a search using like:
Client client = node.client();
ActionFuture<SearchResponse> searchFuture = client.search(new
SearchRequest("journalindex"));
SearchResponse search = searchFuture.get();
I get:
Exception in thread "main" java.util.concurrent.ExecutionException:
org.elasticsearch.cluster.block.ClusterBlockException: blocked by:
[SERVICE_UNAVAILABLE/1/state not recovered /
initialized];[SERVICE_UNAVAILABLE/2/no master];
at
org.elasticsearch.common.util.concurrent.BaseFuture$Sync.getValue(BaseFuture.java:288)
at
org.elasticsearch.common.util.concurrent.BaseFuture$Sync.get(BaseFuture.java:275)
at
org.elasticsearch.common.util.concurrent.BaseFuture.get(BaseFuture.java:113)
at
com.netaporter.cms.estests.test.EsDataLessNodeTest.main(EsDataLessNodeTest.java:32)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
any idea on why this is happening?
--
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/88c7a121-5ffb-43db-8e1d-ce6534a33a26%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.