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

Atlas クラスターの作成と設定

このチュートリアルでは、 Atlas 設定コマンドを使用して次の操作を行う方法を説明します。

  1. Atlas プロジェクトに 1 つのクラスターを作成します。

  2. Load sample data into your Atlas cluster.

  3. IP アドレスをプロジェクトの IP アクセス リストに追加します。

  4. Atlas クラスターの MongoDB ユーザーを作成します。

  5. Connect to your new cluster using the MongoDB Shell, mongosh.

新しい Atlas アカウントの作成中にこれらのすべての手順を実行するには、「 Atlas を使い始める 」を参照してください。

構成ファイルを使用してクラスターを作成するには、atlas setup ではなく --file オプションを指定して、 Atlasクラスター作成コマンドを実行します。 Atlas クラスターの構成ファイルの詳細については、「クラスター構成ファイル 」を参照してください。

また、 atlas setupを使用して Atlas アカウントを作成し、Atlas で認証することもできます。 詳細については、 「 Atlas の使用 」を参照してください。

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

Atlas API のポート 443 (HTTPS) と MongoDB 接続のポート 27017 での発信アクセスを確認します。

Atlas でM0クラスターを作成するには、 atlas setupコマンドを使用します。 M0クラスターには運用上の制限がいくつかあります。

このコマンドは、次の方法で実行できます。

  • デフォルト設定モード: コマンドは、デフォルト設定を持つサンプル共有階層クラスターを作成します。

  • 対話モード: コマンドはクラスター設定を要求し、デフォルト値を提供します。

  • 非対話型モード: オプションを指定して コマンドを実行します。

[] タブをクリックすると、ご希望モードのコマンドが表示されます。

コマンドは、次のデフォルト設定を持つサンプル共有階層クラスターを作成します。

  • クラスター名: Cluster<number>

  • サービスプロバイダー: AWS

  • プロバイダー リージョン: US_EAST_1

  • クラスター階層: M0

  • ディスクサイズ: 0.5 GB

  • データベースユーザー名: Cluster<number>

  • データベースユーザー パスワード: abcdef12345

  • IP アドレス からの接続を許可します。 <YourIPAddress>

  • サンプル データのロード: Yes

  • shell開きます: No

注意

パスワードは自動生成されたランダムな値です。 abcdef12345はサンプル値です。

atlas setup --force
We are deploying Cluster9876543...
Please store your database authentication access details in a secure location
Database User Username: Cluster9876543
Database User Password: abcdef12345
Creating your cluster... [Its safe to 'Ctrl + C']
Cluster created.
Your connection string: mongodb+srv://cluster9876543.example.mongodb.net
Loading sample data into your cluster... [Its safe to 'Ctrl + C']
Now you can connect to your Atlas cluster with: mongosh -u Cluster9876543 -p abcdef12345 mongodb+srv://cluster9876543.example.mongodb.net

クラスターのプロビジョニング後、接続する前に準備が完了していることを確認します。

チェックポイント
検証ステップ

CLI がインストールされました

atlas --version を実行する。このコマンドは、バージョン情報を返します。

認証済み

atlas auth whoami を実行する。このコマンドは、認証されたユーザーを返します。

クラスター作成

CLI 出力には、接続文字列とともに Cluster created. が表示されます。

IP アクセス リストの更新

CLI 出力により、IP アドレスが追加されたことが確認されます。

接続に成功しました

Run atlas clusters connect <cluster-name> or connect with mongosh using the connection string.

Atlas クラスターを作成して検証した後、次の操作を実行できます。

  • Connect your application: Use the connection string with mongosh or a MongoDB driver.

  • セキュリティの構成: アクセスリストに IP アドレスを追加し、アプリケーション固有のデータベースユーザーを作成し、またはプロダクションワークロードのプライベートエンドポイントを有効にします。

  • Load data: Use the --loadSampleData flag during setup, or load your own data with mongoimport or mongorestore.

  • View cluster status: Log in to the UI or run an atlas clusters command in the Atlas CLI.

  • Scale or modify your cluster: See Modify a Cluster.