定義
balancerStopシャーディングされたクラスター内のバランサーを無効にします。 バランシング ラウンドが進行中の場合、 操作はバランシングが完了するまで待機します。
You can only issue the
balancerStopcommand against theadmindatabase on amongosinstance.MongoDB 7.0 以降では、バランサーを停止すると、シャーディングされたクラスターの AutoMerger も無効になります。
重要
バランサーを長期間無効のままにすると、シャードのバランスが取れず、クラスターのパフォーマンスが低下する可能性があります。 必要な場合のみバランサーを無効にし、メンテナンスが完了した後にバランサーを再度有効にするようにします。
Tip
In
mongosh, this command can also be run through thesh.stopBalancer()helper method.Helper methods are convenient for
mongoshusers, 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( { balancerStop: 1, maxTimeMS: <number> } )
コマンドフィールド
フィールド | タイプ | 説明 |
|---|---|---|
| any | 任意の値。 |
| integer | バランサーを無効にする時間制限。 デフォルトは 60000 ミリ秒です。 |
例
バランサー スレッドを停止するには、 mongosインスタンスに接続して次のコマンドを実行します。
db.adminCommand( { balancerStop: 1 } )