balancerStop
定義
balancerStop
Disables the balancer in a sharded cluster. If a balancing round is in progress, the operation waits for balancing to complete.
You can only issue the
balancerStop
against theadmin
database on amongos
instance.重要
Leaving the balancer disabled for extended periods of time can lead to unbalanced shards, which degrade cluster performance. Only disable the balancer if necessary, and ensure that you re-enable the balancer when maintenance is complete.
Tip
mongosh
では、このコマンドはsh.stopBalancer()
ヘルパー メソッドを通じて実行することもできます。ヘルパー メソッドは
mongosh
ユーザーには便利ですが、データベースコマンドと同じレベルの情報は返されない可能性があります。 便宜上必要ない場合、または追加の戻りフィールドが必要な場合は、 データベースコマンドを使用します。MongoDB 6.0.3以降、 自動チャンク分割は実行されません。 これはバランシング ポリシーの改善によるものです。 自動分割コマンドは引き続き存在しますが、操作は実行されません。
In MongoDB versions earlier than 6.1, the command disables auto-splitting for the sharded cluster. To enable auto-splitting when the balancer is disabled, you can use
sh.enableAutoSplit()
.
互換性
このコマンドは、次の環境でホストされている配置で使用できます。
MongoDB Atlas はクラウドでの MongoDB 配置のためのフルマネージド サービスです
重要
このコマンドはサーバーレスインスタンスではサポートされていません。 詳細については、「サポートされていないコマンド 」を参照してください。
MongoDB Enterprise: サブスクリプションベースの自己管理型 MongoDB バージョン
MongoDB Community: ソースが利用可能で、無料で使用できる自己管理型の MongoDB のバージョン
構文
このコマンドの構文は、次のとおりです。
db.adminCommand( { balancerStop: 1, maxTimeMS: <number> } )
コマンドフィールド
フィールド | タイプ | 説明 |
---|---|---|
| any | Any value. |
| integer | Time limit for disabling the balancer. Defaults to 60000 milliseconds. |
例
To stop the balancer thread, connect to a mongos
instance
and issue the following command:
db.adminCommand( { balancerStop: 1 } )