简体   繁体   English

MongoDB-基于范围的分片命令

[英]MongoDB - range based sharding command

I have been reading about MongoDB's range based sharding and want to apply that to my collection with the following rules. 我一直在阅读有关MongoDB基于范围的分片的信息,并希望通过以下规则将其应用于我的集合。 All EntityId fields < 1000 must go to shard 1, EntityId fields between 1001 and 2000 should go to shard 2 and for other EntityId values, go to shard 3. Wonder how the sh.shardCollection looks like for this? 所有<1000的EntityId字段都必须进入分片1,介于1001和2000之间的EntityId字段必须进入分片2,对于其他EntityId值,必须进入分片3。想知道sh.shardCollection的外观如何吗? I couldn't find an example for this. 我找不到这个例子。

I think you should use the command sh.splitAt after sh.shardCollection to get it done. 我认为您应该在sh.shardCollection之后使用命令sh.splitAt来完成它。 There may be must robust solutions. 可能必须有可靠的解决方案。

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

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