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

自己管理型コマンドライン オプションを YAML に変換する

mongod と mongos は、--outputConfig コマンドライン オプションを受け入れて、mongod または mongosインスタンスで使用される構成を出力します。

このオプションを使用して、コマンドライン オプションを YAML 構成に変換できます。

コマンドライン オプションを使用する次のmongod呼び出しについて考えてみましょう。

mongod --shardsvr --replSet myShard --dbpath /var/lib/mongodb --bind_ip localhost,My-Example-Hostname --fork --logpath /var/log/mongodb/mongod.log --clusterAuthMode x509 --tlsMode requireTLS --tlsCAFile /path/to/my/CA/file --tlsCertificateKeyFile /path/to/my/certificate/file --tlsClusterFile /path/to/my/cluster/membership/file

対応する YAML ファイルを生成するには、 --outputConfigコマンドライン オプションを含めます。

mongod --shardsvr --replSet myShard --dbpath /var/lib/mongodb --bind_ip localhost,My-Example-Hostname --fork --logpath /var/log/mongodb/mongod.log --clusterAuthMode x509 --tlsMode requireTLS --tlsCAFile /path/to/my/CA/file --tlsCertificateKeyFile /path/to/my/certificate/file --tlsClusterFile /path/to/my/cluster/membership/file --outputConfig

mongodは次の YAML をstdoutに出力して終了します。

net: bindIp: localhost,My-Example-Hostname tls: CAFile: /path/to/my/CA/file certificateKeyFile: /path/to/my/certificate/file clusterFile: /path/to/my/cluster/membership/file mode: requireTLSoutputConfig: trueprocessManagement: fork: truereplication: replSet: myShardsecurity: clusterAuthMode: x509sharding: clusterRole: shardsvrstorage: dbPath: /var/lib/mongodbsystemLog: destination: file path: /var/log/mongodb/mongod.log

構成ファイルを作成するには、生成されたコンテンツを ファイルにコピーし、YAML からoutputConfig設定を削除します。

コマンドライン オプションを使用する次のmongos呼び出しについて考えてみましょう。

mongos --configdb myCSRS/cfg1.example.net:27019,cfg2.example.net:27019 --bind_ip localhost,My-Example-MONGOS-Hostname --fork --logpath /var/log/mongodb/mongos.log --clusterAuthMode x509 --tlsMode requireTLS --tlsCAFile /path/to/my/CA/file --tlsCertificateKeyFile /path/to/my/certificate/file --tlsClusterFile /path/to/my/cluster/membership/file

--outputConfigこのオプションを指定して、 に対応する YAMLmongos を生成します。

mongos --configdb myCSRS/cfg1.example.net:27019,cfg2.example.net:27019 --bind_ip localhost,My-Example-MONGOS-Hostname --fork --logpath /var/log/mongodb/mongos.log --clusterAuthMode x509 --tlsMode requireTLS --tlsCAFile /path/to/my/CA/file --tlsCertificateKeyFile /path/to/my/certificate/file --tlsClusterFile /path/to/my/cluster/membership/file --outputConfig

mongosは次の YAML をstdoutに出力して終了します。

net: bindIp: localhost,My-Example-MONGOS-Hostname tls: CAFile: /path/to/my/CA/file certificateKeyFile: /path/to/my/certificate/file clusterFile: /path/to/my/cluster/membership/file mode: requireTLSoutputConfig: trueprocessManagement: fork: truesecurity: clusterAuthMode: x509sharding: configDB: myCSRS/cfg1.example.net:27019,cfg2.example.net:27019systemLog: destination: file path: /var/log/mongodb/mongos.log

構成ファイルを作成するには、生成されたコンテンツを ファイルにコピーし、YAML からoutputConfig設定を削除します。

このページを評価