ElasticSearch集群狀態(tài)變成了red無法分片failed shard on node failed to create shard

2024年9月22日00:11:27 發(fā)表評論 1,995 ℃

今天突然收到es集群告警,健康狀態(tài)為red。

查看集群索引分片,的確有3個異常。

ElasticSearch集群狀態(tài)變成了red無法分片failed shard on node failed to create shard

我們也可以通過命令查找是否有異常的分片和索引。

curl -s http://127.0.0.1:9200/_cat/shards/ | grep UNASSIGNED
curl http://127.0.0.1:920/_cat/shards/index_name

ElasticSearch集群狀態(tài)變成了red無法分片failed shard on node failed to create shard

然后可以通過命令查看具體的錯誤信息

curl http://127.0.0.1:9200/_cluster/allocation/explain

ElasticSearch集群狀態(tài)變成了red無法分片failed shard on node failed to create shard

如果有插件的,也可以通過插件查看未分配原因

ElasticSearch集群狀態(tài)變成了red無法分片failed shard on node failed to create shard

報錯詳情:

"details": "failed shard on node [xxx]: failed to create shard, failure IOException[failed to obtain in-memory shard lock]; nested: ShardLockObtainFailedException[[article][5]: obtaining shard lock timed out after 5000ms, previous lock details: [shard creation] trying to lock for [shard creation]]; ",

命令輸出的是json格式,自己找個工具美化一下。

可以看到嘗試分配了5次,都失敗了,沒有可分配的節(jié)點。

ElasticSearch集群狀態(tài)變成了red無法分片failed shard on node failed to create shard

繼續(xù)往后面看,提示讓我手動執(zhí)行重試操作

ElasticSearch集群狀態(tài)變成了red無法分片failed shard on node failed to create shard

于是馬上執(zhí)行命令手動重試

curl -XPOST http://127.0.0.1:9200/_cluster/reroute?retry_failed=true

ElasticSearch集群狀態(tài)變成了red無法分片failed shard on node failed to create shard

再去看狀態(tài)已經(jīng)變成yellow,已經(jīng)開始在分配了

curl http://127.0.0.1:9200/_cluster/health?pretty

ElasticSearch集群狀態(tài)變成了red無法分片failed shard on node failed to create shard

【騰訊云】云服務(wù)器、云數(shù)據(jù)庫、COS、CDN、短信等云產(chǎn)品特惠熱賣中

發(fā)表評論

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: