balancerStatus

On this page本页内容

Definition定义

balancerStatus

Returns a document that contains information about the status of the balancer.返回包含平衡器状态信息的文档。

You can only issue the balancerStatus against the admin database.您只能针对admin数据库发出balancerStatus

The command takes the following form:该命令采用以下形式:

db.adminCommand( { balancerStatus: 1 } )

Output Document输出文档

The following is an example of a document returned by the command:以下是命令返回的文档示例:

{
   "mode" : "full",
   "inBalancerRound" : false,
   "numBalancerRounds" : NumberLong(86),
   "ok" : 1
}
Field字段Description描述
"mode"

A string that specifies whether the balancer thread is running or stopped. 指定平衡器线程是否正在运行或停止的字符串。Possible values are:可能的值包括:

  • "full"
    Balancer thread is running but not necessarily in a balancing round.平衡器线程正在运行,但不一定处于平衡循环中。
  • "off"
    Balancer thread is stopped. 平衡器线程已停止。No chunk balancing can occur in this mode.在此模式下无法进行块平衡。
"inBalancerRound"A boolean that specifies if the balancer is currently in a balancing round; i.e. distributing chunks. 一个布尔值,指定平衡器当前是否处于平衡循环中;即分发块。
"numBalancerRounds"The number of balancer rounds which have occurred since the config servers were started. 自配置服务器启动以来发生的平衡器循环数。This value is not persisted and is reset to 0 upon restart of the config servers. 此值不会持久化,并在重新启动配置服务器时重置为0。

Example示例

Connect to a mongos instance and issue the following command:连接到mongos实例并发出以下命令:

db.adminCommand( { balancerStatus: 1 } )
←  balancerStartbalancerStop →