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

sh.setBalancerState()(mongoshメソッド)

sh.setBalancerState(state)

バランサーを有効または無効にします。

MongoDB 6.0.3以降、 自動チャンク分割は実行されません。 これはバランシング ポリシーの改善によるものです。 自動分割コマンドは引き続き存在しますが、操作は実行されません。

In MongoDB versions earlier than 6.0.3, sh.setBalancerState() also enables auto-splitting if enabling the balancer and disables auto-splitting if disabling the balancer.

バランサーが現在有効か無効かを確認するにはsh.getBalancerState()を使用し、その現在の状態を確認するにはsh.isBalancerRunning()を使用します。

重要

mongosh メソッド

This page documents a mongosh method. This is not the documentation for database commands or language-specific drivers, such as Node.js.

データベースコマンドについては、 balancerStartコマンドとbalancerStopコマンドを参照してください。

MongoDB API ドライバーについては、各言語の「MongoDB ドライバーのドキュメント」を参照してください。

重要

You can only run sh.setBalancerState() on a mongos instance. sh.setBalancerState() errors if run on mongod instance.

The sh.setBalancerState() method has the following parameter:

Parameter
タイプ
説明

state

ブール値

これをtrueに設定してバランサーを有効にし、 falseに設定して無効にします。

バランサーを長期間無効のままにすると、シャードのバランスが取れず、クラスターのパフォーマンスが低下する可能性があります。 必要な場合のみバランサーを無効にし、メンテナンスが完了した後にバランサーを再度有効にするようにします。

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

  • MongoDB Atlas: The fully managed service for MongoDB deployments in the cloud

重要

This command is not supported in M0 and Flex clusters. For more information, see Unsupported Commands.

  • MongoDB Enterprise: サブスクリプションベースの自己管理型 MongoDB バージョン

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

このページを評価