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

構成ファイルを使用して Atlas クラスターを作成する

このチュートリアルでは、Atlas CLI コマンドを使用して、構成ファイルから新しい Atlas クラスターを作成する方法を説明します。 具体的には、次の方法を示します。

  1. 既存のAtlasクラスターの構成設定を取得し、 Atlas clusters describeコマンドを使用して、その設定を構成ファイルに保存します。

  2. Atlasクラスター作成 コマンドを使用して、構成ファイルからAtlas クラスターを作成します。

始める前に、以下のものを用意してください。

このセクションの手順を使用すると、構成ファイルを手動で作成する代わりに、既存のクラスターから設定をエクスポートすることで、新しいクラスターを簡単に作成できます。

1

詳しくは、「 Atlas CLI からの接続 」を参照してください。

2
atlas clusters describe <cluster-name> --output json > myCluster.json

<cluster-name>前述のコマンドの [cluster-name] を、クローンする既存のクラスターの名前に置き換えます。

1

例

次の例では、 viエディターを使用して、 myCluster.jsonファイル内のmySandboxという名前のM10クラスターのレプリカセット設定を表示します。

vi myCluster.json
{ "backupEnabled": true, "biConnector": { "enabled": false, "readPreference": "secondary" }, "clusterType": "REPLICASET", "connectionStrings": { "standard": "<connection-string>" }, "diskSizeGB": 10, "encryptionAtRestProvider": "NONE", "groupId": "<group-id>", "id": "<64403dd1f2a6b45e71527d5a>", "mongoDBMajorVersion": "6.0", "mongoDBVersion": "6.0.5", "name": "mySandbox", "paused": false, "pitEnabled": true, "stateName": "IDLE", "replicationSpecs": [ { "numShards": 1, "id": "64403dbb0a052449df3d04ae", "zoneName": "Zone 1", "regionConfigs": [ { "analyticsAutoScaling": { "diskGB": { "enabled": true }, "compute": { "enabled": true, "scaleDownEnabled": true, "minInstanceSize": "M10", "maxInstanceSize": "M40" } }, "analyticsSpecs": { "diskIOPS": 3000, "ebsVolumeType": "STANDARD", "instanceSize": "M10", "nodeCount": 0 }, "electableSpecs": { "diskIOPS": 3000, "ebsVolumeType": "STANDARD", "instanceSize": "M10", "nodeCount": 3 }, "readOnlySpecs": { "diskIOPS": 3000, "ebsVolumeType": "STANDARD", "instanceSize": "M10", "nodeCount": 0 }, "autoScaling": { "diskGB": { "enabled": true }, "compute": { "enabled": true, "scaleDownEnabled": true, "minInstanceSize": "M10", "maxInstanceSize": "M40" } }, "priority": 7, "providerName": "AWS", "regionName": "US_EAST_1" } ] } ], "createDate": "2023-04-19T19:15:29Z", "rootCertType": "ISRGROOTX1", "versionReleaseSystem": "LTS", "terminationProtectionEnabled": false}
2

オプションおよび必須設定の詳細については、クラスター構成ファイル を参照してください。

3
1

詳しくは、「 Atlas CLI からの接続 」を参照してください。

2
atlas clusters create <new-cluster-name> -f myCluster.json

前述のコマンドの<new-cluster-name>を、作成する新しいクラスターの名前に置き換えます。

3
atlas clusters watch <new-cluster-name>

前のコマンドの <new-cluster-name> を新しいクラスターの名前に置き換えます。

このコマンドは、クラスターのステータスがIDLE状態に達するまで定期的にクラスターのステータスをチェックします。 クラスターが期待どおりの状態に達すると、コマンドは「クラスターが利用可能」と表示されます。