Database Manual / Reference / mongosh Methods / Databases

db.printShardingStatus() (mongosh method方法)

Definition定义

db.printShardingStatus()

Prints a formatted report of the sharding configuration and the information regarding existing chunks in a sharded cluster.打印分片配置的格式化报告以及分片集群中现有块的信息。

Only use db.printShardingStatus() when connected to a mongos instance.仅在连接到mongos实例时使用db.printShardingStatus()

The db.printShardingStatus() method has the following parameter:db.printShardingStatus()方法有以下参数:

Parameter参数Type类型Description描述
verboseboolean布尔值

Optional. 可选。Determines the level of verbosity.确定详细程度。

If true, the method displays:如果为true,则该方法显示:

  • Full details of the chunk distribution across shards even if you have 20 or more chunks, as well as the number of chunks on each shard.即使你有20个或更多的块,也要提供分片间块分布的完整细节,以及每个分片上的块数。
  • Details of active mongos instances.活跃mongos实例的详细信息。

If false, the method displays:如果为false,则该方法显示:

  • Full details of the chunk distribution across shards only if you have less than 20 chunks. If you have 20 or more chunks, the method instead returns a too many chunks to print ... message, showing only the number of chunks on each shard.仅当块数少于20个时,才提供分片间块分布的完整细节。如果你有20个或更多的块,该方法会返回too many chunks to print ...消息,仅显示每个分片上的块数。
  • Only the version and number of active mongos instances.仅显示活动mongos实例的版本和数量

The default verbose value is false.默认的详细值为false

See sh.status() (mongosh method方法) for details of the output.有关输出的详细信息,请参阅sh.status()mongosh方法)。

Note

The db.printShardingStatus() method run in mongosh does not return JSON. mongosh中运行的db.printShardingStatus()方法不返回JSON。Use db.printShardingStatus() for manual inspection, and Config Database in scripts.使用db.printShardingStatus()进行手动检查,并在脚本中配置数据库。

Compatibility兼容性

This method is available in deployments hosted in the following environments:此方法在以下环境中托管的部署中可用:

  • MongoDB Atlas: The fully managed service for MongoDB deployments in the cloud:云中MongoDB部署的完全托管服务

Important

This command is not supported in M0 and Flex clusters. For more information, see Unsupported Commands.M0和Flex集群不支持此命令。有关详细信息,请参阅不支持的命令

  • MongoDB Enterprise: The subscription-based, self-managed version of MongoDB:MongoDB的基于订阅的自我管理版本
  • MongoDB Community: The source-available, free-to-use, and self-managed version of MongoDB:MongoDB的源代码可用、免费使用和自我管理版本