irpas技术客

elasticsearch 报错 NoShardAvailableActionException: No shard available for routing

网络投稿 4446

elasticsearch NoShardAvailableActionException 1. 检查健康状态2. 查看unassigned类型的索引名字3. 删除unassigned状态的索引参考

1. 检查健康状态 curl --user 用户名:密码 -XGET http://本机ip:端口/_cluster/health\?pretty

我不加–user 用户名:密码 会报错,还有如果使用127.0.0.1或者localhost,可能会报错not route to host,反正我是遇到了。

{ "cluster_name" : "elasticsearch", "status" : "yellow", "timed_out" : false, "number_of_nodes" : 1, "number_of_data_nodes" : 1, "active_primary_shards" : 1201, "active_shards" : 1201, "relocating_shards" : 0, "initializing_shards" : 0, "unassigned_shards" : 50, "delayed_unassigned_shards" : 0, "number_of_pending_tasks" : 0, "number_of_in_flight_fetch" : 0, "task_max_waiting_in_queue_millis" : 0, "active_shards_percent_as_number" : 96.00319744204636 }

green为健康状态,red为不健康,yellow在两者之间,但仍不健康。

2. 查看unassigned类型的索引名字

可以看到有很多unssigned,就是此类导致的报错。

authentication-2021.02.20 3 p STARTED 72 169.1kb 96.0.193.57 LasG0MY authentication-2021.02.20 1 p STARTED 65 104.8kb 96.0.193.57 LasG0MY authentication-2021.02.20 2 p STARTED 58 124.9kb 96.0.193.57 LasG0MY authentication-2021.02.20 4 p STARTED 64 141.1kb 96.0.193.57 LasG0MY authentication-2021.02.20 0 p STARTED 81 149.8kb 96.0.193.57 LasG0MY mobile01-2021.03.02 3 p STARTED 3 33kb 96.0.193.57 LasG0MY mobile01-2021.03.02 3 r UNASSIGNED mobile01-2021.03.02 1 p STARTED 5 46.6kb 96.0.193.57 LasG0MY mobile01-2021.03.02 1 r UNASSIGNED mobile01-2021.03.02 2 p STARTED 7 96.6kb 96.0.193.57 LasG0MY

由于我的是单机环境,没有启用副本分片,可以将副本设置为0 。

curl --user 用户名:密码 -XGET http://本机ip:端口/_settings' -H 'content-Type:application/json' -d' {"number_of_replicas":0}' 3. 删除unassigned状态的索引 curl --user 用户名:密码 -XGET http://本机ip:端口/authentication-2021.02.20 等等。。。

其中,authentication-2021.02.20 为unassigned 状态的名字。

参考 [1] https://·/FLY_DREAM/p/14269859.html


1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,会注明原创字样,如未注明都非原创,如有侵权请联系删除!;3.作者投稿可能会经我们编辑修改或补充;4.本站不提供任何储存功能只提供收集或者投稿人的网盘链接。

标签: #ElasticSearch #报错 #no #shard #available #for #Routing