Docs Menu

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 the admin database on a mongos 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>
}
)
フィールド
タイプ
説明

balancerStop

any

Any value.

maxTimeMS

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 } )