balancerStatus
定義
balancerStatus
Returns a document that contains information about the status of the balancer.
You can only issue the
balancerStatus
against theadmin
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 }
フィールド | 説明 |
---|---|
| A string that specifies whether the balancer thread is running or stopped. Possible values are:
|
| A boolean that specifies if the balancer is in a
balancing round. If
|
| 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 } )