Docs Menu
Docs Home
/ /
Atlas CLI
/

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

項目一覧

  • 前提条件
  • Atlas クラスターの構成
  • 次のステップへ進む

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

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

  2. サンプル データを Atlas クラスターにロードします。

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

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

  5. MongoDB Shell である mongoshを使用して新しいクラスターに接続します。

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

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

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

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

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

コマンドはクラスター設定を要求し、デフォルト オプションを提供します。 プロンプトが表示されたら、 Yを押し、次にEnterを押してデフォルト設定を受け入れます。

atlas setup
Press [Enter] to use the default values.
Enter [?] on any option to get help.
[Default Settings]
Cluster Name: Cluster9876543
Cloud Provider and Region: AWS - US_EAST_1
Database User Username: Cluster9876543
Load sample data: Yes
Allow connections from (IP Address): <your-IP>
? Do you want to set up your first free database in Atlas with default settings (it's free forever)? Yes
We are deploying Quickstart-9876543...
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

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

  • クラスター名: getStarted

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

  • プロバイダー リージョン: US_EAST-1

  • クラスター階層: M0

  • ディスクサイズ: 2 GB

  • MongoDB バージョン: 5.0

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

atlas setup --clusterName getStarted --provider AWS --region US_EAST_1 --username testUser --password changeMe --accessListIp 192.0.2.15 --skipSampleData --force
We are deploying getStarted...
Please store your database authentication access details in a secure location:
Database User Username: testUser
Database User Password: changeMe
Creating your cluster... [Its safe to 'Ctrl + C']
Now you can connect to your |service| cluster with: mongosh -u testUser -p changeMe mongodb+srv://getStarted.example.mongodb.net

成功します。 データをホストするためのクラスターが正常に作成されました。

接続文字列を使用して、 mongoshまたはアプリケーションを介してクラスターに接続します。

クラスターのステータスを表示する には、以下を行います。

戻る

Atlas の利用を開始する