今天突然收到es集群告警,健康狀態(tài)為red。
查看集群索引分片,的確有3個異常。
我們也可以通過命令查找是否有異常的分片和索引。
curl -s http://127.0.0.1:9200/_cat/shards/ | grep UNASSIGNED curl http://127.0.0.1:920/_cat/shards/index_name
然后可以通過命令查看具體的錯誤信息
curl http://127.0.0.1:9200/_cluster/allocation/explain
如果有插件的,也可以通過插件查看未分配原因
報錯詳情:
"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é)點。
繼續(xù)往后面看,提示讓我手動執(zhí)行重試操作
于是馬上執(zhí)行命令手動重試
curl -XPOST http://127.0.0.1:9200/_cluster/reroute?retry_failed=true
再去看狀態(tài)已經(jīng)變成yellow,已經(jīng)開始在分配了
curl http://127.0.0.1:9200/_cluster/health?pretty
贊
0
賞