对于 AI 代理:可在 https://www.mongodb.com/zh-cn/docs/llms.txt 获取文档索引—通过在任何 URL 路径后添加 .md 可获取所有页面的 Markdown 版本。
Docs 菜单

管理集群分片

重要

The feature described on this page is not currently supported on Atlas Infinite clusters during public preview. For the features supported in public preview, see Public Preview Availability.

You can horizontally scale your Atlas deployment by sharding your cluster. Sharding allows you to distribute your data across multiple nodes or shards to efficiently handle growing data and workloads. To learn more, see Sharding. If your shard reaches capacity, you can configure auto-scaling to independently scale your shards.

配置分片扩展时,请记住以下几点:

  • 所有分片上的可选节点、只读节点和分析节点的数量必须相同。

    对于全局集群,每个区域可以有不同数量的节点。

  • 所有分片上的存储容量必须相同。

  • 所有分片上的 NVME层级必须相同。

  • 如果启用计算自动伸缩:

    • 最小和最大层级适用于集群级别。

    • Atlas自动伸缩器只允许具有最高集群层分片与具有最低集群层的分片之间最大为 2 的层级间隙。

    注意

    如果分片位于不同的集群类上,则无法为每个分片配置自动伸缩。示例,如果一个分片处于 M30(常规)状态,而另一个分片处于 M40(低 CPU)状态,则无法启用自动伸缩。

Independent shard scaling allows you to configure each shard separately to better meet the workload requirements of each shard. You can configure the cluster tier of each individual shard for a customized and optimized allocation of resources and cost for each shard. That is, on each shard, your electable and read-only nodes can be on a different cluster tier than analytic nodes. On AWS and Azure, you can also configure disk performance for each shard.

示例,对于一个分片,您可以在 M30 上配置可选举和只读节点(3 节点)并在 M40 上配置分析节点(1 节点),而对于另一个分片,您可以在 上配置可选举和只读节点(节点),而对于另一个分片,您可以在以及 M40 上的只读节点(3 节点)和 M30 上的分析节点(1节点)。

您可以使用Atlas Cluster Builder 用户用户界面对集群分片。对集群进行分片的后,您可以使用最新版本的Atlas Admin API、Atlas CLI或HashiCorp Terraform MongoDB Atlas Provider来独立扩展每个分片。您无法使用Atlas用户界面独立扩展每个分片。但是,您可以在Atlas用户界面中启用计算自动伸缩,以使分片独立扩展。

使用Atlas管理API、 Atlas CLI或 Terraform 独立扩展每个分片后,您将无法使用Atlas集群构建器 用户用户界面管理集群。

您可以使用Atlas管理API、 Atlas CLI或 Terraform 为每个分片选择不同的层级。 分析节点还可以在所有分片上具有独立选择的层。

当您从Atlas用户界面编辑具有多个分片层的分片集群时,更改层级将更改所有分片的层级。

您可以使用Atlas Management API为每个分片指定不同的 IOPS。

如果您的集群位于Amazon Web Services上,请为每个分片选择“标准 IOPS”或“预配置 IOPS”。如果分片使用预配 IOPS,您可以为每个分片预配不同的 IOPS。如果分片使用标准 IOPS,则标准 IOPS 与集群的存储大小相关。

如果您的集群在 Azure 支持 扩展存储/IOPS 的区域中,您可以给每个分片预配不同的标准 IOPS。否则,标准 IOPS 与集群磁盘的存储大小绑定。要了解更多信息,请参阅在 Azure 上配置扩展存储/IOPS。

Atlas 集群中的所有分片都可以统一扩展到相同的集群层。默认情况下,在 9 年 2024 月 日之前创建的分片集群使用集群范围的分片扩展。如果您使用 Atlas Administration API、Atlas CLI 或 Terraform 管理集群,请升级您的 Atlas Administration API、Atlas CLI 或 Terraform 以独立扩展您的分片。如果您使用 Atlas 用户界面并启用了计算自动伸缩,若要独立扩展分片,请联系 MongoDB 支持部门。

要学习;了解有关对 M30 或更大集群分片的更多信息,请参阅部署分片集群和修改分片数量。