Can't use the Java API with data-less node

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.

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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/8e4f8d55-743a-4b44-bcef-8d04d3efb3d1%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/1b089bd3-411e-444a-b2f7-20534ba75190%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

I don't think but yes you should set your node as a client node .client(true) and don't add too many settings.

Wondering if the port 9300 is opened on your nodes?

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 14 août 2014 à 08:08, Manthan Shah msshah8@gmail.com a écrit :

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 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/1b089bd3-411e-444a-b2f7-20534ba75190%40googlegroups.com.
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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/28D93982-2292-42E0-BC33-E7FF95C4638F%40pilato.fr.
For more options, visit https://groups.google.com/d/optout.

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 msshah8@gmail.com 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 elasticsearch+unsubscribe@googlegroups.com.
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 elasticsearch+unsubscribe@googlegroups.com.
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.

Is the clusterName set correctly?

--
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/3b956394-5f7b-4f01-87ed-a227b2218e6b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.