繁体   English   中英

Mongodb平衡很慢

[英]Mongodb balancing very slow

我们的集群正在经历非常缓慢的平衡。 在我们的日志中,似乎迁移进度几乎没有取得进展:

2016-01-25T22:21:15.907-0600 I SHARDING [conn142] moveChunk data transfer progress: { active: true, ns: "music.fav_artist_score", from: "rs1/MONGODB01-SRV:27017,MONGODB05-SRV:27017", min: { _id.u: -9159729253516193447 }, max: { _id.u: -9157438072680830290 }, shardKeyPattern: { _id.u: "hashed" }, state: "clone", counts: { cloned: 128, clonedBytes: 12419, catchup: 0, steady: 0 }, ok: 1.0 } my mem used: 0
2016-01-25T22:21:16.932-0600 I SHARDING [conn142] moveChunk data transfer progress: { active: true, ns: "music.fav_artist_score", from: "rs1/MONGODB01-SRV:27017,MONGODB05-SRV:27017", min: { _id.u: -9159729253516193447 }, max: { _id.u: -9157438072680830290 }, shardKeyPattern: { _id.u: "hashed" }, state: "clone", counts: { cloned: 128, clonedBytes: 12419, catchup: 0, steady: 0 }, ok: 1.0 } my mem used: 0
2016-01-25T22:21:17.957-0600 I SHARDING [conn142] moveChunk data transfer progress: { active: true, ns: "music.fav_artist_score", from: "rs1/MONGODB01-SRV:27017,MONGODB05-SRV:27017", min: { _id.u: -9159729253516193447 }, max: { _id.u: -9157438072680830290 }, shardKeyPattern: { _id.u: "hashed" }, state: "clone", counts: { cloned: 128, clonedBytes: 12419, catchup: 0, steady: 0 }, ok: 1.0 } my mem used: 0

此外,当我们对新集合进行分片时。 它最初只在相同的主副本集中以8个块开始。 它不会将块迁移到其他分片

我们的配置是副本集中的4个副本集(主要,辅助,仲裁)和3个配置。 sh.getBalancerState()和sh.isBalancerRunning()都返回true

在MongoDB中,分片性能取决于为分片数据库选择的密钥。 因为,您的块总是存储在单个节点上,所以您选择的分片键极有可能单调递增 要避免此问题,请对密钥进行散列以允许在所有分片中正确平衡块。 使用以下命令进行散列分片。

sh.shardCollection( "<your-db>", { <shard-key>: "hashed" } )

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM