Recovering from NoNodeAvailableException


(Nemo) #1

Hi All,
I am running ES 1.4.4 and ES client on the same machine and the health of cluster looks like below

{
cluster_name: "vmanage-elastic-cluster",
status: "yellow",
timed_out: false,
number_of_nodes: 1,
number_of_data_nodes: 1,
active_primary_shards: 60,
active_shards: 60,
relocating_shards: 0,
initializing_shards: 0,
unassigned_shards: 60
}

Server was up for couple of days and suddenly I am seeing NoNodeAvailableException. Below is the stack trace

[com.company.server.elasticsearch.ElasticSearchDataStore] (Device statistics Sync Timer) Failed to execute query: org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: []
	at org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.java:278) [elasticsearch-1.4.4.jar:]
	at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:197) [elasticsearch-1.4.4.jar:]
	at org.elasticsearch.client.transport.support.InternalTransportClient.execute(InternalTransportClient.java:106) [elasticsearch-1.4.4.jar:]
	at org.elasticsearch.client.support.AbstractClient.search(AbstractClient.java:334) [elasticsearch-1.4.4.jar:]
	at org.elasticsearch.client.transport.TransportClient.search(TransportClient.java:424) [elasticsearch-1.4.4.jar:]
	at org.elasticsearch.action.search.SearchRequestBuilder.doExecute(SearchRequestBuilder.java:1116) [elasticsearch-1.4.4.jar:]
	at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:91) [elasticsearch-1.4.4.jar:]
	at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:65) [elasticsearch-1.4.4.jar:]
	at com.company.server.elasticsearch.ESDataStore.executeQuery(ESDataStore.java:169) [classes:]
	.....
	at com.company.server.statistics.StatisticsDataManager.startTimerBasedSync(StatisticsDataManager.java:153) [classes:]
	at com.company.server.statistics.StatisticsDataManager.access$000(StatisticsDataManager.java:58) [classes:]
	at com.company.server.statistics.StatisticsDataManager$1.run(StatisticsDataManager.java:141) [classes:]
	at java.util.TimerThread.mainLoop(Timer.java:555) [rt.jar:1.8.0_25]
	at java.util.TimerThread.run(Timer.java:505) [rt.jar:1.8.0_25]

In my project, constant number of static TransportClient objects are created which are dedicated only for insert operation (More frequently generated data) and for query and insert (Less frequent) operation TransportClient objects are created dynamically and they are closed as soon as operation is over. What I noticed here is that all insert operations(insert -More frequently generated data) are going though fine with the static object but query/insert is failing when I create TransportClient on fly (Initially works fine but eventually throws NoNodeAvailableException).

Both insert and query operations works fine when I create client from separate Java program (Outside the project).

Below is the code snippet which I am using to create TransportClient

 public Client getClient() {
        ImmutableSettings.Builder settings = ImmutableSettings.settingsBuilder();
        settings.put("cluster.name", ElasticSearchConstants.SERVER_CLUSTER)
        .put("client.transport.nodes_sampler_interval", "15s").put("client.transport.ping_timeout", "15s") 
        .put("client.transport.ignore_cluster_name", false);
        Client client = new TransportClient(settings).addTransportAddress(new InetSocketTransportAddress(
                ElasticSearchConstants.SERVER_HOST, ElasticSearchConstants.SERVER_PORT));
        return client;
                   }

I am really not sure what is going wrong. Can some one tell how to recover from this exception? Please let me know if more information is needed.


(Jason Wee) #2

try add this?

.put("client.transport.sniff", true)

hth


(Nemo) #3

Is it really required to set client.transport.sniff to true? Because there is only one cluster.


(Jason Wee) #4

i think you should first try to fix your es cluster from state yellow to green . and then try the sniff option to see if it help on the no node exception.


(Nemo) #5

I see the reason behind ES cluster state showing yellow. It is because of number of nodes is 1 and there is no extra node available to create replica. Our current requirement is to have only one node and we do not want to create any replica. Apart from this, is there any way to turn the status into green?


(system) #6