重新分配达到重试上限的分片(reroute retry_failed)
Elasticsearch集群/节点命令
# Attempt count and last failure details:
GET _cluster/allocation/explain?filter_path=index,shard,unassigned_info.reason,unassigned_info.failed_allocation_attempts,unassigned_info.details,allocate_explanation
# After fixing the cause, retry shards that hit the limit:
POST _cluster/reroute?retry_failed=true&metric=none
# Recovery progress:
GET _cat/recovery?v&active_only=true&h=index,shard,stage,source_node,target_node,bytes_percent,translog_ops_percent作用
显示因连续失败而停止分配(ALLOCATION_FAILED、max_retry)的分片的失败详情,并再次触发分配;监控恢复进度。
适用场景
allocation explain 显示 'shard has exceeded the maximum number of retries' 时;在磁盘已满、translog 损坏或临时网络问题解决之后。
注意
不修复原因就运行 retry_failed,分片会再尝试 5 次并再次失败;先解决 unassigned_info.details 中的错误。若大量分片同时进入恢复,网络和磁盘负载会上升;受 cluster.routing.allocation.node_concurrent_recoveries 和 indices.recovery.max_bytes_per_sec 限制。