--- title: "分片恢复内部操作超时配置" date: 2026-03-28 lastmod: 2026-03-28 description: "控制分片恢复内部操作超时时间的配置项说明" tags: ["索引配置", "分片恢复", "超时配置"] summary: "配置项作用 # indices.recovery.internal_action_timeout 配置项控制分片恢复过程中内部操作的超时时间。这是恢复过程中各个阶段的默认超时时间。 配置项类型 # 该配置项为动态配置,可以在运行时通过集群设置 API 进行修改。 默认值 # 15m 是否必需 # 可选配置项(有默认值) 取值范围 # 0 ~ 正无穷 配置格式 # # 默认配置 indices.recovery.internal_action_timeout: 15m # 增加超时时间 indices.recovery.internal_action_timeout: 30m # 减少超时时间 indices.recovery.internal_action_timeout: 10m # 快速失败 indices.recovery.internal_action_timeout: 5m 相关配置项 # 配置项 默认值 说明 indices.recovery.internal_action_timeout 15m 内部操作超时 indices.recovery.internal_action_long_timeout 30m 长操作超时 indices.recovery.retry_delay_network 5s 网络重试延迟 工作原理 # 内部操作超时机制:" --- ## 配置项作用 `indices.recovery.internal_action_timeout` 配置项控制分片恢复过程中内部操作的超时时间。这是恢复过程中各个阶段的默认超时时间。 ## 配置项类型 该配置项为**动态配置**,可以在运行时通过集群设置 API 进行修改。 ## 默认值 ``` 15m ``` ## 是否必需 **可选配置项**(有默认值) ## 取值范围 ``` 0 ~ 正无穷 ``` ## 配置格式 ```yaml # 默认配置 indices.recovery.internal_action_timeout: 15m # 增加超时时间 indices.recovery.internal_action_timeout: 30m # 减少超时时间 indices.recovery.internal_action_timeout: 10m # 快速失败 indices.recovery.internal_action_timeout: 5m ``` ## 相关配置项 | 配置项 | 默认值 | 说明 | |-------|-------|------| | `indices.recovery.internal_action_timeout` | 15m | 内部操作超时 | | `indices.recovery.internal_action_long_timeout` | 30m | 长操作超时 | | `indices.recovery.retry_delay_network` | 5s | 网络重试延迟 | ## 工作原理 内部操作超时机制: ``` ┌─────────────────────────────────────────────────────────────────┐ │ 恢复操作超时 │ └─────────────────────────────────────────────────────────────────┘ 恢复操作开始 │ ├── 阶段 1: 准备 ├── 阶段 2: 传输文件 ├── 阶段 3: 验证 └── 阶段 4: 完成 │ └── 每个阶段都有 internal_action_timeout │ ├── 操作完成 │ └── 操作超时 │ └── 放弃恢复,标记失败 ``` ## 使用场景 ### 1. 默认配置(推荐) ```yaml indices.recovery.internal_action_timeout: 15m ``` 适用于大多数集群配置。 ### 2. 大分片恢复 ```yaml indices.recovery.internal_action_timeout: 30m ``` **适用场景:** - 大型分片 - 慢速网络 - 大量数据传输 ### 3. 快速失败场景 ```yaml indices.recovery.internal_action_timeout: 5m ``` **适用场景:** - 快速检测问题 - 不希望长时间等待 - 有自动重试机制 ### 4. 高延迟网络 ```yaml indices.recovery.internal_action_timeout: 45m indices.recovery.max_bytes_per_sec: 10mb ``` **适用场景:** - 跨地域恢复 - 低带宽网络 - 容忍长传输时间 ## 推荐设置建议 | 分片大小 | 网络带宽 | 推荐超时 | 说明 | |---------|---------|---------|------| | < 10GB | 标准 | 15m | 默认配置 | | 10-50GB | 标准 | 15-30m | 根据传输时间 | | > 50GB | 标准 | 30-60m | 大分片需要更多时间 | | 任意 | 慢速 | 30-60m | 低带宽环境 | | 任意 | 快速 | 10-15m | 快速网络可减少 | ## 动态配置示例 ```bash # 更新集群配置 PUT /_cluster/settings { "transient": { "indices.recovery.internal_action_timeout": "30m" } } ``` ## 监控建议 ```bash # 查看恢复进度 GET /_cat/recovery?v&h=i,s,t,bytes_percent,stage # 查看恢复详情 GET /_cat/recovery?v&active_only=true # 查看超时配置 GET /_cluster/settings?filter_path=*.recovery.internal_action_timeout ``` ## 故障排查 ### 恢复超时 1. 检查网络带宽 2. 检查分片大小 3. 增加超时时间 4. 减少并发恢复 ### 恢复速度慢 1. 检查 max_bytes_per_sec 配置 2. 检查网络连接 3. 检查磁盘 I/O ## 注意事项 1. **动态更新**:此配置为动态配置,可在线修改 2. **涵盖多个阶段**:适用于恢复过程的多个阶段 3. **与分片大小相关**:大分片需要更长超时 4. **与网络带宽相关**:低带宽需要更长超时 5. **与 long_timeout 配合**:长操作使用 long_timeout