Sharding Methods

Note

有关特定方法的详细信息,包括语法和示例,请单击特定方法以转到其参考页。

NameDescription
sh.addShard()shard添加到分片群集。
sh.addShardTag()在 MongoDB 3.4 中,此方法别名为sh.addShardToZone()
sh.addShardToZone()将分片与区域关联。支持在分片群集中配置zones
sh.addTagRange()在 MongoDB 3.4 中,此方法别名为sh.updateZoneKeyRange()
sh.disableBalancing()在分片数据库中的单个集合上禁用平衡。不会影响分片群集中其他集合的平衡。
sh.enableBalancing()如果先前使用sh.disableBalancing()禁用了分片集合平衡器进程,则将其激活。
sh.disableAutoSplit()禁用分片群集的自动拆分。
sh.enableAutoSplit()对分片群集启用自动拆分。
sh.enableSharding()在特定数据库上启用分片。
sh.getBalancerHost()自 MongoDB 3.4 起不推荐使用
sh.getBalancerState()返回一个布尔值以报告当前是否启用了balancer
sh.removeTagRange()在 MongoDB 3.4 中,此方法别名为sh.removeRangeFromZone()
sh.removeRangeFromZone()删除一系列分片键和区域之间的关联。支持在分片群集中配置zones
sh.help()返回sh方法的帮助文本。
sh.isBalancerRunning()返回一个布尔值以报告平衡器进程当前是否正在迁移块。
sh.moveChunk()chunk迁移到sharded cluster
sh.removeShardTag()在 MongoDB 3.4 中,此方法别名为sh.removeShardFromZone()
sh.removeShardFromZone()删除分片和区域之间的关联。用于 Managementzone sharding
sh.setBalancerState()启用或禁用在shards之间迁移chunksbalancer
sh.shardCollection()为集合启用分片。
sh.splitAt()使用特定的shard key值作为分割点,将现有的chunk分为两个块。
sh.splitFind()将包含与查询匹配的文档的现有chunk分为两个大致相等的块。
sh.startBalancer()启用balancer,然后 await 平衡开始。
sh.status()报告sharded cluster的状态,即db.printShardingStatus()
sh.stopBalancer()禁用balancer,并 await 所有进行中的平衡回合完成。
sh.waitForBalancer()内部。await 平衡器状态更改。
sh.waitForBalancerOff()内部。await 直到平衡器停止运行。
sh.waitForPingChange()内部。await 分片群集中mongos之一的 ping 状态更改。
sh.updateZoneKeyRange()将一系列分片密钥与区域关联。支持在分片群集中配置zones