Transport Client - NoNodeAvailableException[None of the configured nodes are available]

Dear Sir

I got the following error message when I tried to use transport client:

Exception in thread "main" NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{zSavWRA4QBGzdYdox-h2Aw}{localhost}{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.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 org.young.App.main(App.java:58)

I follow the document to write the following java code:

Settings settings = Settings.builder()
                .put("cluster.name", "elasticsearch")
                .put("client.transport.sniff", true)
                .build();
        TransportClient client = new PreBuiltTransportClient(settings)
               .addTransportAddress(new 
InetSocketTransportAddress(InetAddress.getByName("localhost"), 9300));

From the Kibana console GET _nodes/_all, I can see the nodes information in the end of attachment. I am sure the client java version and server side version are the same. Also, the port number, clustername, and host are correct.

Could you give me more hints to solve this issue?

Thank you so much.

Young
{
"_nodes": {
"total": 1,
"successful": 1,
"failed": 0
},
"cluster_name": "elasticsearch",
"nodes": {
"tc29L00fSAWX4_SdbvWbSQ": {
"name": "tc29L00",
"transport_address": "127.0.0.1:9300",
"host": "127.0.0.1",
"ip": "127.0.0.1",
"version": "5.4.3",
"build_hash": "eed30a8",
"total_indexing_buffer": 213005107,
"roles": [
"master",
"data",
"ingest"
],
"settings": {
"client": {
"type": "node"
},
"cluster": {
"name": "elasticsearch"
},
"http": {
"host": "0.0.0.0",
"type": {
"default": "netty4"
}
},
"node": {
"name": "tc29L00"
},
"path": {
"logs": "/usr/share/elasticsearch/logs",
"home": "/usr/share/elasticsearch"
},
"transport": {
"type": {
"default": "netty4"
}
}
},

1 Like

Dear All

I solved the issue.
I used the docker image to run the elastic search.

The command on this page: https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html

docker run -p 9200:9200 -e "http.host=0.0.0.0" -e "transport.host=127.0.0.1" docker.elastic.co/elasticsearch/elasticsearch:5.4.3

-e "transport.host=127.0.0.1" did not work.

I have to change the elasticsearch.yml, uncomment this line:

transport.host: 0.0.0.0

So that the transport client can correctly connect to port 9300.

Found another issue if I turned on

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

It will cause the same error. I need to remove this line in my setting configuration.

2 Likes

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