mongodb
runtime_error
ai_generated
true
MongoServerError: 均衡器轮次迁移失败:命名空间 mydb.mycoll 的块迁移失败
MongoServerError: balancer round migration failed: chunk migration failed for namespace mydb.mycoll
ID: mongodb/balancer-round-migration-failure
85%修复率
88%置信度
1证据数
2023-11-15首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| MongoDB 7.0 | active | — | — | — |
| MongoDB 6.0 | active | — | — | — |
| MongoDB 8.0 (early access) | active | — | — | — |
根因分析
由于临时网络问题或源/目标分片上的冲突操作,均衡器无法迁移块。
English
The balancer failed to migrate a chunk due to a temporary network issue or a conflicting operation on the source or target shard.
解决方案
-
Check balancer state and retry migration after resolving any conflicting operations (e.g., long-running queries or index builds). Use sh.status() to monitor balancer activity.
-
Increase balancer window or reduce chunk size to make migrations more manageable: use sh.setBalancerState(true) and adjust chunk size via sh._setBalancerChunkSize(64) (in MB).
-
Force chunk migration manually using moveChunk with a specific shard key range and wait for completion: sh.moveChunk('mydb.mycoll', { shardKey: value }, 'targetShard').
无效尝试
常见但无效的做法:
-
60% 失败
moveChunk may fail with same error if underlying issue persists, and can disrupt ongoing migrations.
-
70% 失败
Stopping balancer is a temporary pause, not a fix; the root cause (e.g., network blip) remains.
-
50% 失败
Restart often doesn't resolve underlying connectivity or operation conflicts.