诊断卡住的 ILM 步骤并重试(_ilm/explain、_ilm/retry)
Elasticsearch索引生命周期命令
# Indices waiting in an error step:
GET log-*/_ilm/explain?only_errors=true
# Phase/action/step state and failure reason for one index:
GET log-000003/_ilm/explain?filter_path=indices.*.phase,indices.*.action,indices.*.step,indices.*.failed_step,indices.*.step_info,indices.*.is_auto_retryable_error
# After fixing the cause (example: missing rollover alias setting):
PUT log-000003/_settings
{
"index.lifecycle.rollover_alias": "log"
}
POST log-000003/_ilm/retry
# Is ILM running (if STOPPED, POST _ilm/start):
GET _ilm/status作用
显示停在 ERROR 步骤的索引、卡在哪个 phase/action/step 以及失败原因(step_info);原因修复后重新执行失败的步骤。
适用场景
rollover 没有发生、旧索引未被删除,或磁盘被本应由 ILM 删除的索引占满时。
注意
_ilm/retry 仅对处于 ERROR 步骤的索引有效;否则返回 'has not encountered an error'。常见原因:缺少 rollover_alias 设置或该别名的 is_write_index 位于另一个索引上、单个节点上没有足够磁盘执行 shrink、分配规则(_tier_preference)无法满足。删除策略不会解除索引的 ILM 管理;先从索引上移除策略设置。