配置项作用 #
cluster.routing.allocation.cluster_concurrent_rebalance 配置项控制集群中允许同时进行的重新平衡(rebalance)操作的最大数量。重新平衡是指分片在节点间的迁移操作。此配置用于控制集群重新平衡的并发度,防止过多的同时迁移影响集群性能。
配置项类型 #
该配置项为动态配置,可以在运行时通过集群设置 API 进行修改。
默认值 #
2
是否必需 #
可选配置项(有默认值)
取值范围 #
-1 ~ 正整数(-1 表示不限制)
配置格式 #
# 默认配置
cluster.routing.allocation.cluster_concurrent_rebalance: 2
# 增加并发度
cluster.routing.allocation.cluster_concurrent_rebalance: 4
# 不限制并发
cluster.routing.allocation.cluster_concurrent_rebalance: -1
# 禁用重新平衡
cluster.routing.allocation.cluster_concurrent_rebalance: 0
工作原理 #
重新平衡并发控制:
┌─────────────────────────────────────────────────────────────────┐
│ 重新平衡并发控制 │
└─────────────────────────────────────────────────────────────────┘
请求重新平衡
│
▼
检查当前正在进行的重新平衡数量
│
├── 当前数量 < cluster_concurrent_rebalance
│ │
│ └── 允许新的重新平衡
│
└── 当前数量 >= cluster_concurrent_rebalance
│
└── 节流,拒绝新的重新平衡
使用场景 #
1. 默认配置(推荐) #
cluster.routing.allocation.cluster_concurrent_rebalance: 2
适用于大多数集群配置。
2. 大规模集群 #
cluster.routing.allocation.cluster_concurrent_rebalance: 4
适用于节点数量多、磁盘性能好的集群。
3. 不限制 #
cluster.routing.allocation.concurrency_rebalance: -1
允许尽可能多的并发重新平衡。
4. 禁用重新平衡 #
cluster.routing.allocation.cluster_concurrent_rebalance: 0
推荐设置建议 #
| 集群规模 | 推荐值 | 说明 |
|---|---|---|
| 小型 (< 10 节点) | 2 | 默认配置 |
| 中型 (10-50 节点) | 2-4 | 根据存储性能 |
| 大型 (> 50 节点) | 4-8 | 提高并发度 |
| 高性能存储 | 可增加 | SSD 支持高并发 |
监控建议 #
# 查看当前配置
GET /_cluster/settings?filter_path=*.cluster.routing.allocation.cluster_concurrent_rebalance
# 查看正在迁移的分片
GET /_cat/nodes?v&h=name,host,relocating_shards
# 查看集群平衡状态
GET /_cat/allocation?v
注意事项 #
- 动态更新:此配置为动态配置,可在线修改
- 存储性能:根据存储 I/O 性能调整并发度
- 网络负载:高并发会增加网络流量
- 集群稳定性:过高的并发可能影响集群稳定性





