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

MongoDB リソースのストレージ オプションの構成

MongoDB CustomResourceDefinition で特定のストレージにバインドするようにMongoDBリソースを構成できます。MongoDB CustomResourceDefinition の persistenceフィールドを使用すると、 Kubernetes がMongoDB のカスタム リソースから生成されたログとメタデータを保存する場所をより正確に管理できます。ログとメタデータのストレージを制御すると、この生成されたメタデータを管理および操作するプロセスをよりきめ細やかに制御できます。

MongoDB CustomResourceDefinition では、コンポーネントごとに永続性設定を構成できます。これらの設定では、特定のコンポーネントと 1 つ以上の関連する PersistentVolume リソースとの関係を指定できます。これはMongoDBカスタム リソースからの出力を保存します。

persistence設定は、Kubernetes クラスター内の MongoDB カスタム リソースが管理するオブジェクトに関連付けられたpersistentVolumesの数とストレージ容量を指定します。

MongoDB 配置のストレージ オプションを構成するには、MongoDB Kubernetes Operator を通じて配置された MongoDB レプリカセット が必要です。または、次の前提条件を満たす必要があります。

特定のコンポーネントがすべてのMongoDB CustomResourceDefinition 出力を保存する単一の PersistentVolume を作成するには、コンポーネントの persistence を single として定義します。コンポーネントの data、journal、logs に対して個別の PersistentVolume を作成するには、コンポーネントの persistence を multiple として定義します。

1

次の例に示すように、MongoDB CRD 定義のpersistenceセクションにデータを入力します。

---apiVersion: mongodb.com/v1kind: MongoDBmetadata: name: my-sharded-clusterspec: shardCount: 2 mongodsPerShardCount: 3 mongosCount: 2 configServerCount: 3 version: "8.0.0" service: my-service type: ShardedCluster persistent: true configSrvPodSpec: persistence: single: true shardPodSpec: persistence: multiple: # if the child of "multiple" is omitted then the default size will be used. # 16GB for "data", 1GB for "journal", 3GB for "logs" data: storage: "20Gi" storageClass: standard # You must define a storageClass, as the Operator creates a PVC, which will only create an associated PV with a backing storageClass. logs: storage: "4Gi" storageClass: standard...
2
kubectl apply -f mongodb-crd.yaml
このページを評価

項目一覧