Getting MasterNotDiscoveredException for ES node for client


(bagui) #1

Hi,

I'm using the below code for indexing data from cloud. But getting the
below exception while calling prepareIndex . Please let me know why the
exception is coming.

public static IndexResponse insertESDocument(String nodeName, String json)
{
Node node =
nodeBuilder().clusterName("elasticsearch").client(true).data(false).node();

Client client = node.client();
logger.debug("the node has been created with == "
+node.settings().getAsMap());
logger.debug("the json received as == "+json);

IndexResponse response =
client.prepareIndex("aricloud-nodes","node-entry",nodeName )
.setSource(json)
.execute()
.actionGet();
client.close();
node.close();
return response;
}

--- Exception
07-04-2014 17:45:48,073 WARN [http-apr-8080-exec-4] xxxxxxxxxxxxxxx 1588 -
RunNodesException
org.elasticsearch.discovery.MasterNotDiscoveredException: waited for [1m]
at
org.elasticsearch.action.support.master.TransportMasterNodeOperationAction$3.onTimeout(TransportMasterNodeOperationAction.java:180)
at
org.elasticsearch.cluster.service.InternalClusterService$NotifyTimeout.run(InternalClusterService.java:491)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)

Thanks,
Subhadip

--
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/34e8098a-5a0c-40dd-a5a0-7ee2d22fce4c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(bagui) #2

Please suggest. I'm getting connection error in elasticsearch end even if
the node is running.

[2014-04-07 17:22:40,109][WARN ][transport.netty ] [node-master]
exception caught on transport layer [[id: 0xd2
f92b59, 0.0.0.0/0.0.0.0:64313]], closing connection
java.net.SocketException: Network is unreachable: no further information
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at
sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:701)
at
org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.connect(NioClientBoss.java:150)
at
org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.processSelectedKeys(NioClientBoss.java:105)
at
org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.process(NioClientBoss.java:79)
at
org.elasticsearch.common.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:318)
at
org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.run(NioClientBoss.java:42)
at
org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)

--
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/0dd852b6-e5a1-46ce-994c-496bbac0575e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(bagui) #3

Hi,

If I remove client(true) from node initialization then I'm successfully
indexing documents. But I want to create this node as client only without
shards being allocated to them, as stated
in http://www.elasticsearch.org/guide/en/elasticsearch/client/java-api/current/client.html

Also I'm getting below exception when creating index for existing shards.
Please inform what is the issue here...

07-04-2014 22:33:30,813 WARN
[elasticsearch[node-master][clusterService#updateTask][T#1]]
org.elasticsearch.common.logging.log4j.Log4jESLogger 129 - [node-master]
failed to connect to node
[[Spoilsport][BVej5jdZRIearNwMRcrCYg][Subhadip-PC][inet[/192.168.1.3:9302]]{client=true,
data=false}]

org.elasticsearch.transport.ConnectTransportException:
[Spoilsport][inet[/192.168.1.3:9302]] connect_timeout[30s]

at
org.elasticsearch.transport.netty.NettyTransport.connectToChannels(NettyTransport.java:718)

at
org.elasticsearch.transport.netty.NettyTransport.connectToNode(NettyTransport.java:647)

at
org.elasticsearch.transport.netty.NettyTransport.connectToNode(NettyTransport.java:615)

at
org.elasticsearch.transport.TransportService.connectToNode(TransportService.java:129)

--
Subhadip

--
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/6ed9c982-ea2e-41dc-bdb4-cf4590075229%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(David Pilato) #4

Sounds like you have a network issue?

java.net.SocketException: Network is unreachable: no further information

May be multicast is disabled on your network so you'd better give a unicast list of nodes?

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

Le 7 avr. 2014 à 19:18, Subhadip Bagui i.bagui@gmail.com a écrit :

Hi,

If I remove client(true) from node initialization then I'm successfully indexing documents. But I want to create this node as client only without shards being allocated to them, as stated in http://www.elasticsearch.org/guide/en/elasticsearch/client/java-api/current/client.html

Also I'm getting below exception when creating index for existing shards. Please inform what is the issue here...

07-04-2014 22:33:30,813 WARN [elasticsearch[node-master][clusterService#updateTask][T#1]] org.elasticsearch.common.logging.log4j.Log4jESLogger 129 - [node-master] failed to connect to node [[Spoilsport][BVej5jdZRIearNwMRcrCYg][Subhadip-PC][inet[/192.168.1.3:9302]]{client=true, data=false}]

org.elasticsearch.transport.ConnectTransportException: [Spoilsport][inet[/192.168.1.3:9302]] connect_timeout[30s]

at org.elasticsearch.transport.netty.NettyTransport.connectToChannels(NettyTransport.java:718)

at org.elasticsearch.transport.netty.NettyTransport.connectToNode(NettyTransport.java:647)

at org.elasticsearch.transport.netty.NettyTransport.connectToNode(NettyTransport.java:615)

at org.elasticsearch.transport.TransportService.connectToNode(TransportService.java:129)

--
Subhadip

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/6ed9c982-ea2e-41dc-bdb4-cf4590075229%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/B720114D-9C3C-4887-8442-7D3C716C797B%40pilato.fr.
For more options, visit https://groups.google.com/d/optout.


(bagui) #5

Hi David,

If I restart ES the same is working. But gives me this issue if multiple
call made after some time.

My client and server are on the same system. I stopped the firewall also.
Any suggestion how to make multicast working. Can I create and close client
node for multiple times?

--
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/eef4ddbf-884e-41e6-a387-b1980cf23320%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(David Pilato) #6

You should share the same node and client across all threads.

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

Le 8 avr. 2014 à 06:06, Subhadip Bagui i.bagui@gmail.com a écrit :

Hi David,

If I restart ES the same is working. But gives me this issue if multiple call made after some time.

My client and server are on the same system. I stopped the firewall also.
Any suggestion how to make multicast working. Can I create and close client node for multiple times?

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/eef4ddbf-884e-41e6-a387-b1980cf23320%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/5E36D4AC-C8DC-47F4-8D5F-B69FF4FF8618%40pilato.fr.
For more options, visit https://groups.google.com/d/optout.


(bagui) #7

Hi David,

I'm trying to store all cloud event related data like create node, delete
node etc. in ES. So whenever a new event occurs I'm creating a new node and
client, doing the indexing and then closing the node.

As you said, should I use same node created and use that in all occurence?
like using a singleton? or can I create node every time with same name and
close it after ES operation done? Pls suggest.

Thanks.
Subhadip

--
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/1c2eba75-2653-48a5-9906-9b72b156d64f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(David Pilato) #8

Singleton is the way to go. Node and Client is thread safe.

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr

Le 8 avril 2014 à 10:49:59, Subhadip Bagui (i.bagui@gmail.com) a écrit:

Hi David,

I'm trying to store all cloud event related data like create node, delete node etc. in ES. So whenever a new event occurs I'm creating a new node and client, doing the indexing and then closing the node.

As you said, should I use same node created and use that in all occurence? like using a singleton? or can I create node every time with same name and close it after ES operation done? Pls suggest.

Thanks.
Subhadip

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/1c2eba75-2653-48a5-9906-9b72b156d64f%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/etPan.5343b905.431bd7b7.164d%40MacBook-Air-de-David.local.
For more options, visit https://groups.google.com/d/optout.


(bagui) #9

Thanks a lot David :slight_smile:

--
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/ecf94974-ff55-4fc9-9d09-1d2bd8a48060%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(bagui) #10

Hi David,

The singleton instance for client I'm not getting for existing client.
Trying something like this. Can you please give some working example.

public class ESClientSingleton {

private static ESClientSingleton instance;
private ESClientSingleton()
{

}

public static Object getInstance()
{
if (instance == null)
{
ImmutableSettings.Builder settings = ImmutableSettings.settingsBuilder();
settings.put("node.client", true);
settings.put("node.data", false);
settings.put("node.name", "node-client");
settings.put("cluster.name", "elasticsearch");
settings.build();
Client client = new TransportClient(settings)
.addTransportAddress(new
InetSocketTransportAddress("localhost", 9300));
return client;
}
return instance;
}
}

--
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/7057090c-6b4f-4877-9a58-77fa3d16f2fb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(David Pilato) #11

Looks good to me.
I don't understand what your problem actually is.

May be you don't have a fully working cluster?

What gives GET / for example?

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr

Le 8 avril 2014 à 17:17:44, Subhadip Bagui (i.bagui@gmail.com) a écrit:

Hi David,

The singleton instance for client I'm not getting for existing client. Trying something like this. Can you please give some working example.

public class ESClientSingleton {

private static ESClientSingleton instance;
private ESClientSingleton()
{

}

public static Object getInstance()
{
if (instance == null)
{
ImmutableSettings.Builder settings = ImmutableSettings.settingsBuilder();
settings.put("node.client", true);
settings.put("node.data", false);
settings.put("node.name", "node-client");
settings.put("cluster.name", "elasticsearch");
settings.build();
Client client = new TransportClient(settings)
.addTransportAddress(new InetSocketTransportAddress("localhost", 9300));
return client;
}
return instance;
}
}

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/7057090c-6b4f-4877-9a58-77fa3d16f2fb%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/etPan.53442198.721da317.164d%40MacBook-Air-de-David.local.
For more options, visit https://groups.google.com/d/optout.


(bagui) #12

Hi,

The issue is that if I leave ES inactive for some time I get java.net.SocketException:
Network is unreachable error. I have to restart ES to get it worked. May be
too many node or client is created.
So I'm trying to use the same client instance created for all ES. But the
singleton instance is not returning.

The cluster is working fine and through REST its GET I'm getting all
indexes.

Thanks
Subhadip

--
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/92c69cdc-a06c-45ea-a8a2-7c984de95fbf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #13