ANNOUNCEMENT: Voyage AI joins MongoDB to power more accurate and trustworthy AI applications on Atlas.
Learn more
Docs Menu

balancerStatus

balancerStatus

Returns a document that contains information about the status of the balancer.

You can only issue the balancerStatus against the admin database.

Tip

mongoshでは、このコマンドはsh.isBalancerRunning()ヘルパー メソッドを通じて実行することもできます。

ヘルパー メソッドはmongoshユーザーには便利ですが、データベースコマンドと同じレベルの情報は返されない可能性があります。 便宜上必要ない場合、または追加の戻りフィールドが必要な場合は、 データベースコマンドを使用します。

このコマンドは、次の環境でホストされている配置で使用できます。

  • MongoDB Atlas はクラウドでの MongoDB 配置のためのフルマネージド サービスです

重要

このコマンドはサーバーレスインスタンスではサポートされていません。 詳細については、「サポートされていないコマンド 」を参照してください。

  • MongoDB Enterprise: サブスクリプションベースの自己管理型 MongoDB バージョン

  • MongoDB Community: ソースが利用可能で、無料で使用できる自己管理型の MongoDB のバージョン

このコマンドの構文は、次のとおりです。

db.adminCommand(
{
balancerStatus: 1
}
)

以下は、 コマンドによって返されるドキュメントの例えです。

{
"mode" : "full",
"inBalancerRound" : false,
"numBalancerRounds" : NumberLong(86),
"ok" : 1
}
フィールド
説明

"mode"

A string that specifies whether the balancer thread is running or stopped. Possible values are:

  • " full"
    バランサー スレッドは実行中ですが、必ずしもバランシング ラウンドではありません。
  • "OFF"
    Balancer thread is stopped. No chunk balancing can occur in this mode.

"inBalancerRound"

A boolean that specifies if the balancer is in a balancing round. If inBalancerRound=true, it is now distributing chunks.

inBalancerRound can be true when mode=off. If you turn the balancer off while it's in a balancing round, the server lets it finish rather than interrupting it.

"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.

Connect to a mongos instance and issue the following command:

db.adminCommand( { balancerStatus: 1 } )