NoNodeAvailableException[None of the configured nodes are available exception

I am using ES 5.4.2 and Java 1.8 and getting below error while connecting to local ES server.

Exception in thread "main" NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{cv2EOOhCQ3OeqIFvyfrtYQ}{127.0.0.1}{127.0.0.1:9300}]]
at org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.java:348)
at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:246)
at org.elasticsearch.client.transport.TransportProxyClient.execute(TransportProxyClient.java:59)
at org.elasticsearch.client.transport.TransportClient.doExecute(TransportClient.java:366)
at org.elasticsearch.client.support.AbstractClient.execute(AbstractClient.java:408)
at org.elasticsearch.client.support.AbstractClient$IndicesAdmin.execute(AbstractClient.java:1256)
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:80)
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:54)

Code:

     Settings settings = Settings.builder()
        .put("client.transport.nodes_sampler_interval", "5s")
        .put("client.transport.sniff", false)
        .put("transport.tcp.compress", true)
        .put("cluster.name", clusterName)
        .put("request.headers.X-Found-Cluster", "${cluster.name}")
        .build();

 TransportClient client = new PreBuiltTransportClient(settings);
 client.addTransportAddress(new InetSocketTransportAddress(address, port));
ActionFuture<ClusterHealthResponse> healthFuture = 
client.admin().cluster().health(Requests.clusterHealthRequest());
            ClusterHealthResponse healthResponse = healthFuture.get(5, TimeUnit.SECONDS);

I think you should read this: https://www.elastic.co/guide/en/x-pack/current/java-clients.html

But im using it in local..do i still need to code the Xpack way ?

I was confused by:

        .put("request.headers.X-Found-Cluster", "${cluster.name}")

Which means to me that you are trying to connect to a cloud cluster.

If local, then it looks good but I'd remove all the Settings but cluster.name.

yml file content : xpack.security.enabled: false

Java Code:

     Settings settings =Settings.builder()
	    		.put("client.transport.sniff",true)
	    		.put("cluster.name", "my-application").build();

       TransportClient  client = new PreBuiltTransportClient(settings)
        .addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("127.0.0.1"), 9300));

       CreateIndexRequestBuilder createIndexRequestBuilder = client.admin().indices().prepareCreate("subu");
       createIndexRequestBuilder.execute().actionGet();

Can you remove .put("client.transport.sniff",true)?

tried that also still not working

Can you share your full elasticsearch logs?

Logs:

[2017-07-04T22:39:02,873][INFO ][o.e.n.Node               ] [] initializing ...
[2017-07-04T22:39:02,992][INFO ][o.e.e.NodeEnvironment    ] [-3-DQ-T] using [1] data paths, mounts [[os (C:)]], net usable_space [4.6gb], net total_space [238.1gb], spins? [unknown], types [NTFS]
[2017-07-04T22:39:02,993][INFO ][o.e.e.NodeEnvironment    ] [-3-DQ-T] heap size [990.7mb], compressed ordinary object pointers [true]
[2017-07-04T22:39:03,642][INFO ][o.e.n.Node               ] node name [-3-DQ-T] derived from node ID [-3-DQ-TFTgqQiQ5-wWGA9g]; set [node.name] to override
[2017-07-04T22:39:03,643][INFO ][o.e.n.Node               ] version[5.4.2], pid[6448], build[929b078/2017-06-15T02:29:28.122Z], OS[Windows 7/6.1/amd64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/1.8.0/25.0-b70]
[2017-07-04T22:39:03,644][INFO ][o.e.n.Node               ] JVM arguments [-Xms1g, -Xmx1g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -XX:+DisableExplicitGC, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -Djdk.io.permissionsUseCanonicalPath=true, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Dlog4j.skipJansi=true, -XX:+HeapDumpOnOutOfMemoryError, -Delasticsearch, -Des.path.home=C:\Subhasish\elasticsearch-5.4.2\elasticsearch-5.4.2]
[2017-07-04T22:39:06,753][INFO ][o.e.p.PluginsService     ] [-3-DQ-T] loaded module [aggs-matrix-stats]
[2017-07-04T22:39:06,753][INFO ][o.e.p.PluginsService     ] [-3-DQ-T] loaded module [ingest-common]
[2017-07-04T22:39:06,753][INFO ][o.e.p.PluginsService     ] [-3-DQ-T] loaded module [lang-expression]
[2017-07-04T22:39:06,755][INFO ][o.e.p.PluginsService     ] [-3-DQ-T] loaded module [lang-groovy]
[2017-07-04T22:39:06,757][INFO ][o.e.p.PluginsService     ] [-3-DQ-T] loaded module [lang-mustache]
[2017-07-04T22:39:06,760][INFO ][o.e.p.PluginsService     ] [-3-DQ-T] loaded module [lang-painless]
[2017-07-04T22:39:06,762][INFO ][o.e.p.PluginsService     ] [-3-DQ-T] loaded module [percolator]
[2017-07-04T22:39:06,764][INFO ][o.e.p.PluginsService     ] [-3-DQ-T] loaded module [reindex]
[2017-07-04T22:39:06,765][INFO ][o.e.p.PluginsService     ] [-3-DQ-T] loaded module [transport-netty3]
[2017-07-04T22:39:06,767][INFO ][o.e.p.PluginsService     ] [-3-DQ-T] loaded module [transport-netty4]
[2017-07-04T22:39:06,770][INFO ][o.e.p.PluginsService     ] [-3-DQ-T] loaded plugin [x-pack]
[2017-07-04T22:39:11,471][INFO ][o.e.x.m.j.p.l.CppLogMessageHandler] [controller/7924] [Main.cc@128] controller (64 bit): Version 5.4.2 (Build 0986144d2d42c8) Copyright (c) 2017 Elasticsearch BV
[2017-07-04T22:39:11,496][INFO ][o.e.d.DiscoveryModule    ] [-3-DQ-T] using discovery type [zen]
[2017-07-04T22:39:13,206][INFO ][o.e.n.Node               ] initialized
[2017-07-04T22:39:13,208][INFO ][o.e.n.Node               ] [-3-DQ-T] starting ...
[2017-07-04T22:39:14,659][INFO ][o.e.t.TransportService   ] [-3-DQ-T] publish_address {127.0.0.1:9300}, bound_addresses {127.0.0.1:9300}, {[::1]:9300}
[2017-07-04T22:39:17,753][INFO ][o.e.c.s.ClusterService   ] [-3-DQ-T] new_master {-3-DQ-T}{-3-DQ-TFTgqQiQ5-wWGA9g}{L6WNXu81Qj6LgFWc2giifw}{127.0.0.1}{127.0.0.1:9300}{ml.enabled=true}, reason: zen-disco-elected-as-master ([0] nodes joined)
[2017-07-04T22:39:18,932][INFO ][o.e.l.LicenseService     ] [-3-DQ-T] license [f23be8bf-5d09-477b-975c-b72400f3d6ec] mode [trial] - valid
[2017-07-04T22:39:19,024][INFO ][o.e.g.GatewayService     ] [-3-DQ-T] recovered [13] indices into cluster_state
[2017-07-04T22:39:23,421][INFO ][o.e.c.r.a.AllocationService] [-3-DQ-T] Cluster health status changed from [RED] to [YELLOW] (reason: [shards started [[test][1]] ...]).
[2017-07-04T22:39:24,921][INFO ][o.e.h.n.Netty4HttpServerTransport] [-3-DQ-T] publish_address {127.0.0.1:9200}, bound_addresses {127.0.0.1:9200}, {[::1]:9200}
[2017-07-04T22:39:24,925][INFO ][o.e.n.Node               ] [-3-DQ-T] started
[2017-07-04T22:39:47,815][WARN ][o.e.c.r.a.DiskThresholdMonitor] [-3-DQ-T] high disk watermark [90%] exceeded on [-3-DQ-TFTgqQiQ5-wWGA9g][-3-DQ-T][C:\Subhasish\elasticsearch-5.4.2\elasticsearch-5.4.2\data\nodes\0] free: 4.5gb[1.9%], shards will be relocated away from this node
[2017-07-04T22:39:47,817][INFO ][o.e.c.r.a.DiskThresholdMonitor] [-3-DQ-T] rerouting shards: [high disk watermark exceeded on one or more nodes]
[2017-07-04T22:40:17,911][WARN ][o.e.c.r.a.DiskThresholdMonitor] [-3-DQ-T] high disk watermark [90%] exceeded on [-3-DQ-TFTgqQiQ5-wWGA9g][-3-DQ-T][C:\Subhasish\elasticsearch-5.4.2\elasticsearch-5.4.2\data\nodes\0] free: 7.5gb[3.1%], shards will be relocated away from this node
[2017-07-04T22:40:48,010][WARN ][o.e.c.r.a.DiskThresholdMonitor] [-3-DQ-T] high disk watermark [90%] exceeded on [-3-DQ-TFTgqQiQ5-wWGA9g][-3-DQ-T][C:\Subhasish\elasticsearch-5.4.2\elasticsearch-5.4.2\data\nodes\0] free: 6.5gb[2.7%], shards will be relocated away from this node
[2017-07-04T22:40:48,011][INFO ][o.e.c.r.a.DiskThresholdMonitor] [-3-DQ-T] rerouting shards: [high disk watermark exceeded on one or more nodes]
[2017-07-04T22:41:18,134][WARN ][o.e.c.r.a.DiskThresholdMonitor] [-3-DQ-T] high disk watermark [90%] exceeded on [-3-DQ-TFTgqQiQ5-wWGA9g][-3-DQ-T][C:\Subhasish\elasticsearch-5.4.2\elasticsearch-5.4.2\data\nodes\0] free: 6.5gb[2.7%], shards will be relocated away from this node

Eclipse Console Logs:

   log4j:WARN No appenders could be found for logger (io.netty.util.internal.logging.InternalLoggerFactory).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{RAs6MMTNS3eaGim9-6jAnA}{127.0.0.1}{127.0.0.1:9300}]]
	at org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.java:348)
	at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:246)
	at org.elasticsearch.client.transport.TransportProxyClient.execute(TransportProxyClient.java:59)
	at org.elasticsearch.client.transport.TransportClient.doExecute(TransportClient.java:366)
	at org.elasticsearch.client.support.AbstractClient.execute(AbstractClient.java:408)
	at org.elasticsearch.client.support.AbstractClient$IndicesAdmin.execute(AbstractClient.java:1256)
	at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:80)
	at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:54)
	at com.subu.els.demo.ElasticSearchClient.main(ElasticSearchClient.java:57)

Nothing looks very bad.

I mean that I'm not expecting such a None of the configured nodes are available.

That said:

client.admin().indices().prepareCreate("subu").get();

Might be problematic on your cluster because you are running low on disk space:

[2017-07-04T22:39:47,815][WARN ][o.e.c.r.a.DiskThresholdMonitor] [-3-DQ-T] high disk watermark [90%] exceeded on [-3-DQ-TFTgqQiQ5-wWGA9g][-3-DQ-T][C:\Subhasish\elasticsearch-5.4.2\elasticsearch-5.4.2\data\nodes\0] free: 4.5gb[1.9%], shards will be relocated away from this node

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.