I doubt that "local(true)" and unicast can work seamlessly together - either the node should use the network (local=false, which is the default), or not.
Also, before search, a cluster health check would be appropriate, and a cluster nodes info request for the number of data nodes connected. This can give more clues than running into nasty service unavailable errors. Jörg On Thu, Aug 14, 2014 at 8:08 AM, Manthan Shah <[email protected]> wrote: > Was that a really problem for above Error? I doubt this could be a reason. > Facing similar issue with 1.3.1 version > > > On Monday, February 17, 2014 4:08:21 PM UTC+5:30, Dario Rossi wrote: >> >> There's a little mistake >> >> settings.put("node.data", true); >> >> should be >> >> settings.put("node.data", false); >> >> >> >> Il giorno lunedì 17 febbraio 2014 10:30:25 UTC, Dario Rossi ha scritto: >>> >>> 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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/elasticsearch/1b089bd3-411e-444a-b2f7-20534ba75190%40googlegroups.com > <https://groups.google.com/d/msgid/elasticsearch/1b089bd3-411e-444a-b2f7-20534ba75190%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAKdsXoHe0HoXnDavcHiGdSJgQaHTxdi%2B%3D3b0uFVYkKC60cvQ7g%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
