当前位置: 首页 > elasticsearch, 搜索 > 正文

org.elasticsearch.client.transport.NoNodeAvailableException: No node available

1 星2 星3 星4 星5 星 (3 次投票, 评分: 5.00, 总分: 5)
Loading ... Loading ...
baidu_share

今天在测试elasticsearch的实例时,报以下错误:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
12:04:19,390  INFO transport:109 - [Venus] failed to get local cluster state for [#transport#-1][inet[localhost/127.0.0.1:9300]], disconnecting...
org.elasticsearch.transport.ReceiveTimeoutTransportException: [][inet[localhost/127.0.0.1:9300]][cluster/state] request_id [0] timed out after [5001ms]
	at org.elasticsearch.transport.TransportService$TimeoutHandler.run(TransportService.java:342)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:722)
12:04:19,396 DEBUG netty:94 - [Venus] disconnected from [[#transport#-1][inet[localhost/127.0.0.1:9300]]]
12:04:19,402 DEBUG netty:94 - [Venus] connected to node [[#transport#-1][inet[localhost/127.0.0.1:9300]]]
Exception in thread "main" org.elasticsearch.client.transport.NoNodeAvailableException: No node available
	at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:202)
	at org.elasticsearch.client.transport.support.InternalTransportIndicesAdminClient.execute(InternalTransportIndicesAdminClient.java:85)
	at org.elasticsearch.client.support.AbstractIndicesAdminClient.create(AbstractIndicesAdminClient.java:200)
	at org.elasticsearch.action.admin.indices.create.CreateIndexRequestBuilder.doExecute(CreateIndexRequestBuilder.java:206)
	at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:62)
	at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:57)
	at com.hq.search.test.AddPartialFieldTest.createIndex(AddPartialFieldTest.java:178)
	at com.hq.search.test.AddPartialFieldTest.main(AddPartialFieldTest.java:43)

网上搜了一下,说是clustername 制定错误。用http://localhost:9200/_cluster/health/ 查看了一下

1
{"cluster_name":"elasticsearch","status":"green","timed_out":false,"number_of_nodes":1,"number_of_data_nodes":1,"active_primary_shards":0,"active_shards":0,"relocating_shards":0,"initializing_shards":0,"unassigned_shards":0}

没有错误。

百思不其解是,恍然大悟,原来我本机开启的是0.19.9 版本的实例,而程序当中用的是0.90.0版本jar包,换回原版本,问题搞定

本文固定链接: http://www.chepoo.com/org-elasticsearch-client-transport-no-node-available-exception.html | IT技术精华网

org.elasticsearch.client.transport.NoNodeAvailableException: No node available:目前有2 条留言

  1. 板凳
    :

    你的说法不对,解决方案也不对。

    [回复]
  2. 沙发
    :

    es集群版本和客户端调用版本不一致,一般会出现格式不对错误,也有可能出现No node available错误,当时情形,我现在记不清了。

    一般出现No node available错误,大部分是由于es集群正在gc,或者es集群出现了问题。批量索引,索引优化,elasticsearch集群内部节点超时等等都有可能造成No node available错误。

    具体问题,具体分析吧。

    [回复]

发表评论