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

[] (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( [elasticsearch-1.4.4.jar:]
	at org.elasticsearch.client.transport.TransportClientNodesService.execute( [elasticsearch-1.4.4.jar:]
	at [elasticsearch-1.4.4.jar:]
	at [elasticsearch-1.4.4.jar:]
	at [elasticsearch-1.4.4.jar:]
	at [elasticsearch-1.4.4.jar:]
	at org.elasticsearch.action.ActionRequestBuilder.execute( [elasticsearch-1.4.4.jar:]
	at org.elasticsearch.action.ActionRequestBuilder.execute( [elasticsearch-1.4.4.jar:]
	at [classes:]
	at [classes:]
	at$000( [classes:]
	at$ [classes:]
	at java.util.TimerThread.mainLoop( [rt.jar:1.8.0_25]
	at [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("", 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)


(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