mongodb runtime_error ai_generated partial

MongoServerError:均衡器往返时间超过30秒:块迁移超时

MongoServerError: balancer round trip time exceeded 30 seconds: chunk migration timed out for range

ID: mongodb/balancer-round-trip-timeout

其他格式: JSON · Markdown 中文 · English
78%修复率
85%置信度
1证据数
2024-05-12首次发现

版本兼容性

版本状态引入弃用备注
mongodb 6.0 active — — —
mongodb 7.0 active — — —
mongodb 8.0 active — — —

根因分析

由于网络延迟或源分片过载,分片间的块迁移失败,超过了30秒的往返时间阈值。

English

Chunk migration between shards failed due to network latency or overloaded source shard, exceeding the 30-second round-trip threshold.

generic

官方文档

https://www.mongodb.com/docs/manual/reference/command/moveChunk/

解决方案

  1. Temporarily disable the balancer to allow pending migrations to complete: `sh.stopBalancer(10000)` then re-enable after monitoring network latency between shards.
  2. Increase chunk size to reduce migration frequency: `db.adminCommand({ setClusterParameter: { chunkSize: 128 } })` and ensure source shard has sufficient I/O capacity.
  3. Use `db.adminCommand({ moveChunk: 'mydb.mycoll', find: { shardKey: value }, to: 'targetShard', maxTimeMS: 60000 })` to manually migrate chunks with a longer timeout after verifying network health.

无效尝试

常见但无效的做法:

  1. 90% 失败

    The timeout is caused by underlying network or resource issues, not stale balancer state; restarting only delays recovery and may lose migration progress.

  2. 95% 失败

    The round-trip timeout is a hard-coded balancer limit, not a client-side query timeout; adjusting maxTimeMS does not affect internal balancer logic.

  3. 80% 失败

    Stopping all chunk migrations leads to data imbalance, reduced query performance, and eventual cluster instability.