X-pack PreBuiltXPackTransportClient occurs NoNodeAvailableException

Hi, I'm using ES 5.1.1 with Kibana 5.1.1.

I planned to setup x-pack on both ES and Kibana to use authentication.

What I've configured setting is below.

========================

org.elasticsearch.client
x-pack-transport
5.1.1

TransportClient client = new PreBuiltXPackTransportClient(Settings.builder()
.put("cluster.name", ES_CLUSTER_NAME)
.put("xpack.security.user", "elastic:@password")
.put("xpack.security.transport.ssl.enabled", "false")
.build())
.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(ES_HOST), ES_PORT));

But I got below exception even though I had tried to catch my potential mistake after reading this post 3 times.
https://www.elastic.co/guide/en/x-pack/5.1/java-clients.html

NoNodeAvailableException[None of the configured nodes are available:

On the other hand, Kibana and CURL was successful with default 9200 port.
Also, transportclient works well after removing x-pack on ES to make sure my connection info.

Can anybody help me out to resolve this issue?

Thanks for reading this.

Note that ES_PORT must be 9300.

@dadoonet, Thanks for the replay.

I did set the port to 9300 which is a default port for TransportService.

However, the message occured like above.

May be share your elasticsearch logs so we are sure you bound the network host.

@dadoonet
Here's what I got after trying to connect to my ES with transport port(9300).
I masked my dns and ip info.

NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{OGuljAe5SvuFwB_b0G56lQ}{DNS}{IP:9300}]
]
at org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.java:328)
at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:226)
at org.elasticsearch.client.transport.TransportProxyClient.execute(TransportProxyClient.java:59)
at org.elasticsearch.client.transport.TransportClient.doExecute(TransportClient.java:345)
at org.elasticsearch.client.support.AbstractClient.execute(AbstractClient.java:403)
at org.elasticsearch.client.FilterClient.doExecute(FilterClient.java:67)
at org.elasticsearch.client.support.AbstractClient$1.doExecute(AbstractClient.java:1754)
at org.elasticsearch.client.support.AbstractClient.execute(AbstractClient.java:403)
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:80)
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:54)
at org.elasticsearch.action.ActionRequestBuilder.get(ActionRequestBuilder.java:62)
at com.creamsugardonut.etc.EsTest.test1(EsTest.java:54)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:51)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:237)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)

But can you share your elasticsearch logs?

Make sure that port 9300 is opened,

This is my es log.

As I mentioned earlier, I already verified transport port and cluster name are correct by removing x-pack plugin and connecting successfully.

[2017-02-07T08:49:48,409][INFO ][o.e.n.Node ] [] initializing ...
[2017-02-07T08:49:48,472][INFO ][o.e.e.NodeEnvironment ] [v46nvy3] using [1] data paths, mounts [[/ (/dev/sda7)]], net usable_space [51.3gb], net total_space [83.9gb], spins? [no], types [ext4]
[2017-02-07T08:49:48,473][INFO ][o.e.e.NodeEnvironment ] [v46nvy3] heap size [1.9gb], compressed ordinary object pointers [true]
[2017-02-07T08:49:48,474][INFO ][o.e.n.Node ] node name [v46nvy3] derived from node ID [v46nvy3ITcSs62FewBiJlw]; set [node.name] to override
[2017-02-07T08:49:48,475][INFO ][o.e.n.Node ] version[5.1.1], pid[25472], build[5395e21/2016-12-06T12:36:15.409Z], OS[Linux/4.4.0-62-generic/amd64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/1.8.0_121/25.121-b13]
[2017-02-07T08:49:49,824][INFO ][o.e.p.PluginsService ] [v46nvy3] loaded module [aggs-matrix-stats]
[2017-02-07T08:49:49,824][INFO ][o.e.p.PluginsService ] [v46nvy3] loaded module [ingest-common]
[2017-02-07T08:49:49,824][INFO ][o.e.p.PluginsService ] [v46nvy3] loaded module [lang-expression]
[2017-02-07T08:49:49,824][INFO ][o.e.p.PluginsService ] [v46nvy3] loaded module [lang-groovy]
[2017-02-07T08:49:49,824][INFO ][o.e.p.PluginsService ] [v46nvy3] loaded module [lang-mustache]
[2017-02-07T08:49:49,824][INFO ][o.e.p.PluginsService ] [v46nvy3] loaded module [lang-painless]
[2017-02-07T08:49:49,824][INFO ][o.e.p.PluginsService ] [v46nvy3] loaded module [percolator]
[2017-02-07T08:49:49,825][INFO ][o.e.p.PluginsService ] [v46nvy3] loaded module [reindex]
[2017-02-07T08:49:49,825][INFO ][o.e.p.PluginsService ] [v46nvy3] loaded module [transport-netty3]
[2017-02-07T08:49:49,825][INFO ][o.e.p.PluginsService ] [v46nvy3] loaded module [transport-netty4]
[2017-02-07T08:49:49,825][INFO ][o.e.p.PluginsService ] [v46nvy3] loaded plugin [elasticsearch-analysis-mecab-ko]
[2017-02-07T08:49:49,825][INFO ][o.e.p.PluginsService ] [v46nvy3] loaded plugin [lang-javascript]
[2017-02-07T08:49:49,826][INFO ][o.e.p.PluginsService ] [v46nvy3] loaded plugin [x-pack]
[2017-02-07T08:49:50,135][INFO ][o.e.s.ScriptService ] [v46nvy3] compiling script file [/home/lks21c/elasticsearch-5.1.1/config/scripts/my_script.groovy]
[2017-02-07T08:49:52,425][INFO ][o.e.n.Node ] initialized
[2017-02-07T08:49:52,425][INFO ][o.e.n.Node ] [v46nvy3] starting ...
[2017-02-07T08:49:52,652][INFO ][o.e.t.TransportService ] [v46nvy3] publish_address {192.168.43.55:9300}, bound_addresses {[::]:9300}
[2017-02-07T08:49:52,657][INFO ][o.e.b.BootstrapCheck ] [v46nvy3] bound or publishing to a non-loopback or non-link-local address, enforcing bootstrap checks
[2017-02-07T08:49:55,818][INFO ][o.e.c.s.ClusterService ] [v46nvy3] new_master {v46nvy3}{v46nvy3ITcSs62FewBiJlw}{N7H5GCPnQbS7v57ikHcFkQ}{192.168.43.55}{192.168.43.55:9300}, reason: zen-disco-elected-as-master ([0] nodes joined)
[2017-02-07T08:49:55,832][INFO ][o.e.h.HttpServer ] [v46nvy3] publish_address {192.168.43.55:9200}, bound_addresses {[::]:9200}
[2017-02-07T08:49:55,833][INFO ][o.e.n.Node ] [v46nvy3] started
[2017-02-07T08:49:55,936][INFO ][o.e.g.GatewayService ] [v46nvy3] recovered [0] indices into cluster_state

So ES_HOST is 192.168.43.55 and port is 9300 in your code?
Or anything else?

@dadoonet

I'm very sorry for my mistake.

It was caused by Junit's ES Client was set differently.

Again, I'm very sorry to waste your time.

I carefully looked into client configuration and set it correctly and worked well.
Thanks for the reply.

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