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

MongoDB Cloud Manager を使い始める

MongoDB CLI は、 MongoDB Cloud Managerのプロジェクトとクラスターを管理するためのコマンドラインインターフェイスを提供します。

このチュートリアルでは、次の方法を説明します。

  • Cloud Manager プロジェクトでのクラスターの作成

  • 新しいクラスターの詳細を取得する

このチュートリアルで言及されているコマンドのリファレンスページは、 MongoDB CLI コマンド で利用できます。

始める前に、次のタスクを完了してください。

mongocli cloud-manager clusters createコマンドを使用して、Cloud Manager でクラスターを作成します。

次の コマンドは、次の設定を持つサンプル クラスターを作成します。

  • クラスター名: getStarted

  • MongoDB サーバーのバージョン: 5.0.0

  • 機能の互換性バージョン: 5.0

  • レプリカセット ノード 3

  • メンバーホスト名: host1 、 host2 、 host3

    注意

    このチュートリアルでは、ホスト名host1 、 host2 、 host3のホスト名を使用します。 これらのホスト名を有効な MongoDB Server のホスト名に置き換えます。

  • 各mongodインスタンスのデータディレクトリ: /data/cluster/rs1 、 /data/cluster/rs2 、 /data/cluster/rs3

  • 各mongodインスタンスのログファイル パス: /data/cluster/rs1/mongodb.log 、 /data/cluster/rs2/mongodb.log 、 /data/cluster/rs3/mongodb.log

  • 各mongodプロセスのポート: 29010 、 29020 、 29030

  • 各ノードの投票優先順位: 1

  • 各ノードの投票数: 1

1

構成ファイルのプロパティの詳細については、「クラスター構成ファイル 」を参照してください。

{ "name": "getStarted", "version": "5.0.0", "featureCompatibilityVersion": "5.0", "processes": [ { "hostname": "host1", "dbPath": "/data/cluster/rs1", "logPath": "/data/cluster/rs1/mongodb.log", "priority": 1, "votes": 1, "port": 29010 }, { "hostname": "host2", "dbPath": "/data/cluster/rs2", "logPath": "/data/cluster/rs2/mongodb.log", "priority": 1, "votes": 1, "port": 29020 }, { "hostname": "host3", "dbPath": "/data/cluster/rs3", "logPath": "/data/cluster/rs3/mongodb.log", "priority": 1, "votes": 1, "port": 29030 } ]}
2
mongocli cloud-manager cluster create --file getStartedCluster.json

クラスターが正常に作成されたかどうかは、 mongocli cloud-manager clusters describeコマンドを使用してクラスターの詳細を取得することで確認できます。

mongocli cloud-manager cluster describe getStarted

コマンド出力は、次のようになります。

{ "mongoURI": "mongodb://host1:29010,host2:29020,host3:29030", "name": "getStarted", "processes": [ { "buildIndexes": true, "db_path": "/data/cluster/rs1", "featureCompatibilityVersion": "5.0", "hostname": "host1", "log_path": "/data/cluster/rs1/mongodb.log", "name": "getStartedCluster", "port": 29010, "priority": 1, "process_type": "mongod", "slave_delay": 0, "version": "5.0.0", "votes": 1, "arbiter_only": false, "disabled": false, "hidden": false }, { "buildIndexes": true, "db_path": "/data/cluster/rs2", "featureCompatibilityVersion": "5.0", "hostname": "host2", "log_path": "/data/cluster/rs2/mongodb.log", "name": "getStartedCluster", "port": 29020, "priority": 1, "process_type": "mongod", "slave_delay": 0, "version": "5.0.0", "votes": 1, "arbiter_only": false, "disabled": false, "hidden": false }, { "buildIndexes": true, "db_path": "/data/cluster/rs3", "featureCompatibilityVersion": "5.0", "hostname": "host3", "log_path": "/data/cluster/rs3/mongodb.log", "name": "getStartedCluster", "port": 29030, "priority": 1, "process_type": "mongod", "slave_delay": 0, "version": "5.0.0", "votes": 1, "arbiter_only": false, "disabled": false, "hidden": false } ]}

mongocli クラウドマネージャーオートメーション監視コマンドを実行して、クラスターが使用可能かどうかを判断します。 次のコマンドは、デフォルトのプロファイルを使用して Cloud Manager プロジェクトにアクセスします。

mongocli cm automation watch

成功します。 データをホストするためのクラスターが正常に作成されました。 またはアプリケーションの 接続string を使用してクラスターに接続したり、UI にログインしてクラスターを表示したりできます。mongosh