mongodb
runtime_error
ai_generated
partial
MongoServerError: balancer failed to move chunk: chunk { ns: "test.users", min: { _id: 1 }, max: { _id: 100 } } could not be moved
ID: mongodb/balancer-failed-to-move-chunk
78%Fix Rate
85%Confidence
1Evidence
2024-02-10First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| mongodb-5.0 | active | — | — | — |
| mongodb-6.0 | active | — | — | — |
| mongodb-7.0 | active | — | — | — |
Root Cause
The balancer could not move a chunk because the target shard had insufficient storage or the chunk exceeded the maximum chunk size.
generic中文
均衡器无法移动块,因为目标分片存储不足或块大小超过最大块大小。
Official Documentation
https://www.mongodb.com/docs/manual/core/sharding-balancer-administration/Workarounds
-
80% success Check target shard disk usage with db.adminCommand({ listShards: 1 }) and add more shards or free up space on the target.
Check target shard disk usage with db.adminCommand({ listShards: 1 }) and add more shards or free up space on the target. -
75% success Reduce chunk size temporarily via mongos config: use sh.enableAutoSplit() and sh.setBalancerState(true) with smaller chunkSize (e.g., 64MB) to split large chunks before migration.
Reduce chunk size temporarily via mongos config: use sh.enableAutoSplit() and sh.setBalancerState(true) with smaller chunkSize (e.g., 64MB) to split large chunks before migration.
-
70% success Manually move the chunk using sh.moveChunk() with a specific shard key range to force migration during low traffic.
Manually move the chunk using sh.moveChunk() with a specific shard key range to force migration during low traffic.
中文步骤
Check target shard disk usage with db.adminCommand({ listShards: 1 }) and add more shards or free up space on the target.Reduce chunk size temporarily via mongos config: use sh.enableAutoSplit() and sh.setBalancerState(true) with smaller chunkSize (e.g., 64MB) to split large chunks before migration.
Manually move the chunk using sh.moveChunk() with a specific shard key range to force migration during low traffic.
Dead Ends
Common approaches that don't work:
-
50% fail
Increasing chunkSize to a very large value can cause uneven data distribution and balancer inefficiency.
-
50% fail
Disabling the balancer entirely stops automatic data redistribution, leading to uneven shard loads.
-
50% fail
Manually splitting chunks without considering data distribution can create many small chunks that strain the balancer.