Database Manual / Reference / Database Commands

Sharding Commands分片命令

Note

For details on a specific command, including syntax and examples, click on the link to the command's reference page.有关特定命令的详细信息,包括语法和示例,请单击指向该命令参考页面的链接。

Name名称Description描述
abortMoveCollection

Stops an in-progress moveCollection operation.停止正在进行的moveCollection操作。

New in version 8.0.在版本8.0中新增。

abortReshardCollection

Aborts a resharding operation.中止重新分片操作

New in version 5.0.在版本5.0中新增。

abortUnshardCollection

Stops an in-progress unshardCollection operation.停止正在进行的unshardCollection操作。

New in version 8.0.在版本8.0中新增。

addShardAdds a shard to a sharded cluster.分片添加到分片集群
addShardToZoneAssociates a shard with a zone. Supports configuring zones in sharded clusters.将分片与区域关联。支持在分片集群中配置区域
analyzeShardKey

Calculates metrics for evaluating a shard key.计算用于评估分片键的指标。

New in version 7.0.在版本7.0中新增。

balancerCollectionStatusReturns information on whether the chunks of a sharded collection are balanced.返回有关分片集合的块是否平衡的信息。
balancerStartStarts a balancer thread.启动平衡器线程。
balancerStatusReturns information on the balancer status.返回有关平衡器状态的信息。
balancerStopStops the balancer thread.停止平衡器线程。
checkMetadataConsistency

Performs a series of consistency checks on sharding metadata.对分片元数据执行一系列一致性检查。

New in version 7.0.在版本7.0中新增。

clearJumboFlagClears the jumbo flag for a chunk.清除大块的jumbo标志。
cleanupReshardCollection

Cleans up a failed resharding operation.清理失败的重新分片操作

New in version 5.0.在版本5.0中新增。

commitReshardCollection

Forces a resharding operation to block writes and complete.强制执行重新分片操作以阻止写入并完成。

New in version 5.0.在版本5.0中新增。

configureCollectionBalancing

Configures balancer settings on a sharded collection.配置分片集合上的平衡器设置。

New in version 5.3.在版本5.3中新增。

configureQueryAnalyzer

Configures query sampling for a collection.为集合配置查询采样。

New in version 7.0.在版本7.0中新增。

enableShardingCreates a database.创建数据库。
flushRouterConfigForces a mongod / mongos instance to update its cached routing metadata.强制mongod/mongos实例更新其缓存的路由元数据。
getShardMapReturns the hostnames and connection strings for shards in the cluster and the config servers for your cluster.返回集群中分片的主机名和连接字符串,以及集群的配置服务器。
isdbgridVerifies that a process is a mongos.验证进程是否为mongos
listShardsReturns a list of configured shards.返回已配置分片的列表。
moveChunkInternal command that migrates chunks between shards.在分片之间迁移块的内部命令。
movePrimaryReassigns the primary shard when removing a shard from a sharded cluster.从分片集群中删除分片时,重新分配主分片
moveRangeMigrates ranges between shards.分片之间的迁移范围。
mergeAllChunksOnShardSquashes mergeable chunks for a given collection on a shard.在分片上为给定的集合挤压可合并的块。
mergeChunksProvides the ability to combine chunks on a single shard.提供在单个分片上组合块的能力。
refineCollectionShardKeyRefines a collection's shard key by adding a suffix to the existing key.通过向现有键添加后缀来优化集合的分片键。
removeShardStarts the process of removing a shard from a sharded cluster.开始从分片集群中删除分片的过程。
removeShardFromZoneRemoves the association between a shard and a zone. Supports configuring zones in sharded clusters.删除分片和区域之间的关联。支持在分片集群中配置区域
reshardCollection

Initiates a resharding operation to change the shard key for a collection, changing the distribution of your data.启动重新分片操作以更改集合的分片键,从而更改数据的分布。

New in version 5.0.在版本5.0中新增。

setAllowMigrationsPrevents the start of new automatic migrations on a collection, prevents in-flight manual migrations from committing, and excludes the collection from new balancer rounds.防止在集合上启动新的自动迁移,防止正在进行的手动迁移提交,并将该集合排除在新的平衡器轮次之外。
shardCollectionEnables the sharding functionality for a collection, allowing the collection to be sharded.为集合启用分片功能,允许对集合进行分片。
shardingStateReports whether the mongod is a member of a sharded cluster.报告mongod是否是分片集群的成员。
splitCreates a new chunk.创建新
transitionFromDedicatedConfigServer

Configures a dedicated config server to run as a config shard.将专用配置服务器配置为作为配置分片运行。

New in version 8.0.在版本8.0中新增。

transitionToDedicatedConfigServer

Configures a config shard to run as a dedicated config server.将配置分片配置为作为专用配置服务器运行。

New in version 8.0.在版本8.0中新增。

unsetShardingRemoved in MongoDB 5.0.在MongoDB 5.0中删除。 Internal command that affects connections between instances in a MongoDB deployment.影响MongoDB部署中实例之间连接的内部命令。
unshardCollection

Unshards an existing sharded collection and moves the collection data onto a single shard. 解开现有的分片集合,并将集合数据移动到单个分片上。When you unshard a collection, the collection cannot be partitioned across multiple shards and the shard key is removed.当您取消对集合的分区时,该集合不能跨多个分片进行分区,并且分片键将被删除。

New in version 8.0.在版本8.0中新增。

updateZoneKeyRangeAdds or removes the association between a range of sharded data and a zone. 添加或删除分片数据范围与区域之间的关联。Supports configuring zones in sharded clusters.支持在分片集群中配置区域