翻译或纠错本页面

分片方法

注解

For details on specific methods, including syntax and examples, click on the specific method to go to its reference page.

名字

描述

sh._adminCommand()

在admin数据库运行 database command ,就像 db.runCommand() ,不过可以保证只在 mongos 上运行.

sh.getBalancerLockDetails() Reports on the balancer lock.
sh._checkFullName() Tests a namespace to determine if its well formed.
sh._checkMongos()

检测 mongo 终端连接的是否为一个 mongos 示例.

sh._lastMigration()

报告最后进行的 chunk 迁移.

sh.addShard()

向集群中添加一个 shard

sh.addShardTag()

将一个分片与一个标记相关联,用以支持 标记相关的分片.

sh.addShardToZone()

将片键的范围与某个标记相关联,用以支持 标记相关的分片.

sh.addTagRange() In MongoDB 3.4, this method aliases to sh.updateZoneKeyRange().
sh.updateZoneKeyRange()

禁用一个分片数据库中某个集合的均衡过程,这并不影响这个分片数据库中其他分片的均衡过程.

sh.removeTagRange()

如果之前使用了命令 sh.disableBalancing() 禁用了某个集合的均衡过程,这个命令将重新启用均衡过程.

sh.removeRangeFromZone() Removes an association between a range of shard keys and a zone. Supports configuring zones in sharded clusters.
sh.disableBalancing() Disable balancing on a single collection in a sharded database. Does not affect balancing of other collections in a sharded cluster.
sh.enableBalancing() Activates the sharded collection balancer process if previously disabled using sh.disableBalancing().
sh.enableSharding() Enables sharding on a specific database.
sh.getBalancerHost() Deprecated since MongoDB 3.4
sh.getBalancerState() Returns a boolean to report if the balancer is currently enabled.
sh.help() Returns help text for the sh methods.
sh.isBalancerRunning()

打开或关闭在 shards 间迁移 数据块balancer .

sh.moveChunk() Migrates a chunk in a sharded cluster.
sh.removeShardTag()

使用特定的 shard key 值,将一个已经存在的 chunk 分成两部分.

sh.removeShardFromZone()

将包含查询文档的一个已经存在的 chunk 分成两个差不多大小的数据块.

sh.setBalancerState() Enables or disables the balancer which migrates chunks between shards.
sh.shardCollection()

就像 db.printShardingStatus() 一样,返回 sharded cluster 的状态信息.

sh.splitAt() Divides an existing chunk into two chunks using a specific value of the shard key as the dividing point.
sh.splitFind() Divides an existing chunk that contains a document matching a query into two approximately equal chunks.
sh.startBalancer() Enables the balancer and waits for balancing to start.
sh.status() Reports on the status of a sharded cluster, as db.printShardingStatus().
sh.stopBalancer() Disables the balancer and waits for any in progress balancing rounds to complete.
sh.waitForBalancer() Internal. Waits for the balancer state to change.
sh.waitForBalancerOff() Internal. Waits until the balancer stops running.
sh.waitForDLock() Internal. Waits for a specified distributed sharded cluster lock.
sh.waitForPingChange() Internal. Waits for a change in ping state from one of the mongos in the sharded cluster.