コンフィギュレーションシャード
MongoDB 8.0以降では、通常の シャーディングされたシャーディングされたクラスターのメタデータデータ に加えて、アプリケーションデータを保存するようにコンフィギュレーションコンフィギュレーションサーバーを構成できます。 コンフィギュレーションコンフィギュレーションサーバーとシャードサーバーの両方の機能を提供するmongod
ノードは、コンフィギュレーションシャードと呼ばれます。 シャードサーバー機能を持たないスタンドアロン--configsvr
として実行される
mongod
ノードは専用コンフィギュレーションサーバーと呼ばれコンフィギュレーションサーバー。
A sharded cluster must have a config server, but it can be either a config shard (embedded config server) or a dedicated config server. Using a config shard reduces the number of nodes required and can simplify your deployment. A config shard cluster is also called an embedded config server cluster. You cannot use the same config server for multiple sharded clusters.
ユースケース
クラスターのシャードが 3 つ以下の場合は、 コンフィギュレーションシャード の使用を検討してください。
アプリケーションに可用性と回復力の要件がある場合は、専用のコンフィギュレーションサーバーの配置を検討してください。 専用のコンフィギュレーションサーバーは、重要なクラスター操作に対して分離、専用リソース、一貫したパフォーマンスを提供します。
You should use a dedicated config server if you satisfy one or more of the following conditions:
You plan to use more than three shards.
You plan to use 時系列コレクション or Queryable Encryption collections.
You plan to use queryable backups (on-prem).
動作
In an embedded config server cluster, a config shard will be used to store cluster metadata and user data. It helps reduce the complexity of a sharded cluster deployment.
You can store sharded and unsharded collection data in your config shard. It has all the properties of a shard as well as acting as the config server.
コンフィギュレーションシャードの使用を確認する
シャーディングされたクラスターがコンフィギュレーションシャードを使用していることを確認するには、listShards
admin
に接続している間に データベースに対してmongos
コマンドを実行し、_id
が"config"
に設定されているドキュメントの出力を調べます。listShards
の出力に、_id
が "config"
に設定されているドキュメントが含まれていない場合、クラスターはコンフィギュレーションシャードを使用しません。
次の例では、 listShards
コマンドを実行し、_id
が "config"
に設定されているドキュメントを検索しようとします。
db.adminCommand({ listShards: 1 })["shards"].find(element => element._id === "config")
この例では 、返されたドキュメントには、_id
が "config"
に設定されており、これはこのクラスターが コンフィギュレーションシャード を使用していることを確認しています。
{ _id: "config", host: "configRepl/localhost:27018", state: 1, topologyTime: Timestamp({ t: 1732218671, i: 13 }), replSetConfigVersion: Long('-1') }
コマンド
専用のコンフィギュレーションコンフィギュレーションサーバーをコンフィギュレーションシャードとして実行するように構成するには、 transitionFromDedicatedConfigServer
コマンドを実行します。
コンフィギュレーションシャードを専用のコンフィギュレーションコンフィギュレーションサーバーとして実行するように構成するには、 transitionToDedicatedConfigServer
コマンドを実行します。