elasticsearch集羣發生了故障,重新恢復,但是最後有一個分片一直沒有恢復,導致集羣一個主分片丟失,健康狀態呈現紅色。
錯誤如下:
failed shard on node [bPftT3as9siI4nSGLA]: failed to create shard, failure IOException[failed to obtain in-memory shard lock]; nested: ShardLockObtainFailedException[[device_search3][2]: obtaining shard lock timed out after 5000ms, previous lock details: [shard creation] trying to lock for [shard creation]];
# # 集羣呈現紅色狀態,排查錯誤
GET _cluster/allocation/explain
將會看到錯誤,如果發現錯誤是一樣的,那麼就可以用我的方式解決,如果錯誤不一樣,可以嘗試一下。
# # 問題原因,就是這個分片一直沒聯繫上,就任務這個分片丟失了,不再跟它建立聯繫了。
# # 解決問題的方法
POST _cluster/reroute?retry_failed
在kibana上執行一下上邊的內容,分片就開始恢復了。
# # 參考文章