AI エージェント向け: ドキュメントインデックスは https://www.mongodb.com/ja-jp/docs/llms.txt で利用できます。すべてのページの markdown バージョンは、いずれかの URL パスに .md を追加することで利用できます。
Docs Menu

balancerStatus(データベースコマンド)

balancerStatus

バランサーの状態に関する情報を含むドキュメントを返します。

You can only issue the balancerStatus against the admin database.

Tip

In mongosh, this command can also be run through the sh.isBalancerRunning() helper method.

Helper methods are convenient for mongosh users, but they may not return the same level of information as database commands. In cases where the convenience is not needed or the additional return fields are required, use the database command.

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

  • MongoDB Atlas: The fully managed service for MongoDB deployments in the cloud
  • MongoDB Enterprise: サブスクリプションベースの自己管理型 MongoDB バージョン

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

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

db.adminCommand(
{
balancerStatus: 1
}
)

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

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

"mode"

バランサー スレッドが実行中か停止かを指定する string。 可能な値は次のとおりです。

  • " full"
    バランサー スレッドは実行中ですが、必ずしもバランシング ラウンドではありません。
  • "OFF"
    バランサー スレッドが停止されます。 このモードでは、チャンクのバランシングは実行できません。

"inBalancerRound"

バランサー がバランシング ラウンド内かどうかを指定するブール値。 inBalancerRound=trueの場合、チャンクが分散されます。

inBalancerRound trueは、 の場合はmode=off になります。バランサー ラウンド中にバランサーの電源を切ると、サーバーは中断するのではなくバランサーを完了させます。

"numBalancerRounds"

コンフィギュレーションサーバー が起動されて以降に発生した バランサー ラウンドの数。 この値は保持されず、コンフィギュレーションサーバーの再起動時に 0 にリセットされます。

mongosインスタンスに接続し、次のコマンドを発行します。

db.adminCommand( { balancerStatus: 1 } )