Docs 菜单

Docs 主页启动和管理 MongoDBMongoDB Atlas

Atlas 集群 create

在此页面上

  • 语法
  • 参数
  • 选项
  • 继承选项
  • 输出
  • 举例

为您的项目创建集群。

要快速开始,请指定集群名称、云提供商和区域,以部署具有最新 MongoDB 服务器版本的三成员副本集。为了完全控制您的部署,或者创建多云集群,请提供带有 --file 标志的 JSON 配置文件。

要使用此命令,您必须使用具有项目所有者角色的用户帐户或 API 密钥进行身份验证。

命令语法
atlas clusters create [name] [options]
名称
类型
必需
说明
名称
字符串
false
集群名称。 集群名称在创建后无法更改。 集群名称可以包含 ASCII 字母、数字和连字符。 如果不使用 --文件 选项,则必须指定集群名称参数。
名称
类型
必需
说明
--backup
false
为部署启用持续云备份的标志。 此选项不适用于小于 M10 的集群。
--biConnector
false

在部署上启用 BI Connector for Atlas 的标志。

与 --文件 互斥。

--diskSizeGB
浮点
false

主机根卷的容量(以 GB 为单位)。

与 --file 互斥。 此值默认为 2。

--enableTerminationProtection
false
为集群启用终止保护。 无法删除已启用终止保护的集群。
-f, --file
字符串
false

定义集群设置的可选 JSON 配置文件的路径。要了解有关 Atlas CLI 集群配置文件的更多信息,请参阅 https://dochub.mongodb.org/core/cluster-config-file-atlascli 。要了解有关 MongoCLI 集群配置文件的更多信息,请参阅 https://dochub.mongodb.org/core/mms-cluster-settings-file-mcli。

与 层级、提供商、--members、地区、--diskSizeGB、--mdbVersion、--biConnector、--type、--shards、--tag 互斥。

-h,--help
false
创建帮助
--mdbVersion
字符串
false

集群的主要 MongoDB 版本。

与 --文件 互斥。

-m, --members
int
false

副本集中的成员数。

与 --file 互斥。 此值默认为 3。

-o, --output
字符串
false
输出格式。 有效值为 json、json-path、go-template 或 go-template-file。 要查看完整输出,请使用 -o json 选项。
--projectId
字符串
false
标识要使用的项目的十六进制字符串。 此选项会覆盖配置文件或环境变量中的设置。
--provider
字符串
false

您的云服务提供商的名称。 有效值为 Amazon Web Services、Azure 或 GCP。如果不使用 --文件 选项,则必须指定提供商选项。

与 --文件 互斥。

-r, --region
字符串
false

MongoDB 集群的物理位置。如果不使用 --file 选项,则必须指定区域选项。有关支持的 AWS 区域的完整列表,请参阅: https ://dochub.mongodb.org/core/aws-atlas 。有关支持的 Azure 区域的完整列表,请参阅: https ://dochub.mongodb.org/core/azure-atlas 。有关支持的 GCP 区域的完整列表,请参阅: https://dochub.mongodb.org/core/gcp-atlas。

与 --文件 互斥。

-s, --shards
int
false

集群中的分片数量。

与 --file 互斥。 该值默认为 1。

--tag
key=value
false

包含长度介于 1 到 255 个字符之间的键值对的列表,用于对集群进行标记和分类。

与 --文件 互斥。

--tier
字符串
false

集群中每个数据承载服务器的层级。要了解有关集群层的更多信息,请参阅 https://dochub.mongodb.org/core/cluster-tier-atlas。

与 --file 互斥。 此值默认为“M2”。

--type
字符串
false

要创建的集群的类型。 有效值为 REPLICASET 或 SHARDED。

与 --file 互斥。 此值默认为“REPLICASET”。

-w, --watch
false
该标志指示是否监视命令,直到命令完成执行或监视超时。 要设置手表超时的时间,请使用 --watchTimeout 选项。
--watchTimeout
uint
false
手表超时之前的时间(以秒为单位)。 监视超时后,CLI 将不再监视该命令。
名称
类型
必需
说明
-P,--profile
字符串
false
要从配置文件中使用的配置文件的名称。要了解 Atlas CLI 的配置文件,请参阅 https://dochub.mongodb.org/core/atlas-cli-save-connection-settings。

如果命令成功,CLI 将返回类似于以下示例的输出。 括号中的值代表您的价值观。

Cluster '<Name>' is being created.
# Deploy a free cluster named myCluster for the project with the ID 5e2211c17a3e5a48f5497de3:
atlas cluster create myCluster --projectId 5e2211c17a3e5a48f5497de3 --provider AWS --region US_EAST_1 --tier M0
# Deploy a free cluster named myCluster for the project with the ID 5e2211c17a3e5a48f5497de3 and tag "env=dev":
atlas cluster create myCluster --projectId 5e2211c17a3e5a48f5497de3 --provider AWS --region US_EAST_1 --tier M0 --tag env=dev
# Deploy a three-member replica set named myRS in AWS for the project with the ID 5e2211c17a3e5a48f5497de3:
atlas cluster create myRS --projectId 5e2211c17a3e5a48f5497de3 --provider AWS --region US_EAST_1 --members 3 --tier M10 --mdbVersion 5.0 --diskSizeGB 10
# Deploy a three-member replica set named myRS in AZURE for the project with the ID 5e2211c17a3e5a48f5497de3:
atlas cluster create myRS --projectId 5e2211c17a3e5a48f5497de3 --provider AZURE --region US_EAST_2 --members 3 --tier M10 --mdbVersion 5.0 --diskSizeGB 10
# Deploy a three-member replica set named myRS in GCP for the project with the ID 5e2211c17a3e5a48f5497de3:
atlas cluster create myRS --projectId 5e2211c17a3e5a48f5497de3 --provider GCP --region EASTERN_US --members 3 --tier M10 --mdbVersion 5.0 --diskSizeGB 10
# Deploy a cluster or a multi-cloud cluster from a JSON configuration file named myfile.json for the project with the ID 5e2211c17a3e5a48f5497de3:
atlas cluster create --projectId <projectId> --file myfile.json
MongoDB Atlas 是什么? →