Create a sharded cluster instance
ApsaraDB for MongoDB sharded cluster instances are designed for workloads that require high-concurrency reads and writes.
Prerequisites
An Alibaba Cloud account is created. For more information, see 注册阿里云账号.
Usage notes
If your application runs on an ECS instance, ensure that it and the ApsaraDB for MongoDB instance meet the following requirements for network connectivity. For information about how to view ECS instance information, see View instance information.
They are in the same region.
They use the same network type.
NoteTo reduce network latency, place the instances in the same availability zone.
A VPC is recommended for its higher security.
If you use a VPC, both instances must be in the same VPC.
If you want to use a VPC but your ECS instance is in the classic network, you can migrate the ECS instance to a VPC. For more information, see Migrate an ECS instance from the classic network to a VPC.
Supported regions and zones
For information about the regions and zones that support sharded cluster instances, see Supported regions and zones.
Billing rules
An Alibaba Cloud account is created. For more information, see 注册阿里云账号.
Subscription: A prepaid billing method where you pay for the instance upon creation.
Pay-as-you-go: a postpaid billing method where you are billed hourly based on the instance configuration. Fees are automatically deducted from your account balance.
For more information, see Billable items.
如果您是首次购买云数据库MongoDB实例,您可以参与数据库首购折扣价活动,活动信息请参见云数据库优惠活动。
Procedure
Log in to the ApsaraDB for MongoDB console.
In the left-side navigation pane, click Sharded Cluster Instances.
On the Sharded Cluster Instances page, click Create Instance.
In the Product Type section, select Sharded Cluster (Subscription) or Sharded Cluster (Pay-as-you-go).
Configure the following parameters for the sharded cluster instance.
Parameter
Description
Region
Select the region for the instance.
NoteYou cannot change the region of an instance after the instance is created. Choose the region carefully.
If your application runs on an ECS instance, select the same region as the ECS instance for internal network access.
Zone Type
Select the zone deployment type for the instance.
Single-zone: Deploys all Mongos, Shard, and ConfigServer nodes in a single zone.
Dual-zone Deployment: Deploys nodes across two zones for in-city disaster recovery.
Multi-zone: Deploys nodes across three zones for in-city disaster recovery.
NoteFor ApsaraDB for MongoDB instances that use local SSDs, you can select only Single-zone. However, you can deploy a sharded cluster instance across multiple zones by configuring the Zone parameter. To implement a multi-zone deployment, you must select zones in the following format: Region (Zone 1+Zone 2+Zone 3). Example: Shenzhen (C+D+E).
Zone
Select the zone where you want to deploy the instance.
If you set Single-zone、Dual-zone Deployment or Multi-zone, you must also configure the Spare zone parameter. For more information about the supported zones, see Cloud disk-based instances (dual-zone) and Cloud disk-based instances (three-zone).
For more information about the multi-zone deployment strategy for sharded cluster instances, see Node deployment policy.
NoteIf your application runs on an ECS instance, select the same zone as the ECS instance to reduce network latency. For ApsaraDB for MongoDB instances that use local SSDs, you can migrate the instance to another zone. For more information, see Migrate an instance across zones.
Protocol Type
Set to MongoDB Protocol.
Database Version
Select the database version.
If you set Zone Type to Multi-zone, you can select only MongoDB 7.0, MongoDB 6.0, MongoDB 5.0, MongoDB 4.4, or MongoDB 4.2.
NoteIf the Zone, Secondary Zone 1, or Secondary Zone 2 that you select does not support deploying multi-zone sharded cluster instances, the Database Version is not displayed, and you cannot create a sharded cluster instance.
You can upgrade the major version after creating the instance. For more information, see Upgrade the major version of an ApsaraDB for MongoDB instance.
Storage Engine
Set to WiredTiger.
StorageType
Select a storage type for the sharded cluster instance.
ESSD: Enhanced SSDs (ESSDs) are available in the following performance levels (PLs):
ESSD PL1: An ESSD with performance level 1.
ESSD PL2: Provides approximately double the IOPS and throughput of a PL1 ESSD.
ESSD PL3: Delivers up to 20 times the IOPS and 11 times the throughput of a PL1 ESSD. This is ideal for workloads that require high concurrent I/O and low, stable latency.
NoteFor a performance comparison of different cloud disks, such as Disk Capacity Range, Max IOPS per Disk, and Max Throughput per Disk, see ESSDs.
ESSD AutoPL Disk: An ESSD AutoPL disk is compatible with all features of ESSDs. It has the same baseline performance as an ESSD PL1 disk and offers provisioned performance capabilities.
Local SSD: An SSD that is located on the same node as the database engine. Storing data on a local SSD can reduce I/O latency.
The supported storage types vary based on the instance version. The options shown on the purchase page are definitive.
Provisioned Performance
The provisioned IOPS. The value can range from 0 to 50,000.
NoteThis parameter is available only for instances that use ESSD AutoPL disks.
Encryption Type
Enables or disables disk encryption.
NoteDisk encryption is supported only for instances that use ESSDs or ESSD AutoPL disks. For more information, see Configure disk encryption.
Service-linked Role
A service-linked role is required for disk encryption.
The page indicates if a role exists. If not, follow the link on the page to create one.
Encryption Key
Select a key in Key Management Service (KMS) for disk encryption. If no key is available in the current region, create one in the KMS console. For more information, see Create a key.
Category
Select an instance class category.
Resource group
Select a resource group for the instance. For more information, see Create a resource group.
NoteResource groups let you centrally manage cloud resources across regions under a single Alibaba Cloud account.
Tag
Add one or more tags to the instance. For more information, see Tag management.
Network type
Set to VPC.
NoteIf your application runs on an ECS instance, make sure that the network type of the ECS instance is VPC to ensure network connectivity.
VPC
Select the VPC to which the instance belongs. If no VPC is available, go to the VPC console to create one. For more information, see Create and manage a VPC.
NoteFor more information about how to change the network type, see Change the network type of an instance.
You can also use an Express Connect circuit or a VPN gateway to connect your on-premises data center to cloud resources in a VPC to form a hybrid cloud. This helps you smoothly migrate your applications to the cloud. For more information, see Hybrid access solutions for migrating from the classic network to a VPC.
vSwitch
Select the vSwitch to which the instance belongs. If no vSwitch is available, go to the VPC console to create one. For more information, see Create and manage a vSwitch.
mongos规格
Select an instance type for the Mongos component. For more information about the supported instance types, see Sharded cluster instance types.
NoteYou can change the configuration and number of Mongos nodes after the instance is created.
Mongos Nodes
Select the number of Mongos nodes in the instance. Valid values: 2 to 32.
NoteEach Mongos node uses a standalone architecture. For high availability, select two or more nodes.
A single sharded cluster instance supports a maximum of 32 Mongos nodes by default.
Shard Specification
Select an instance type for the Shard component. For more information about the supported instance types, see Sharded cluster instance types.
NoteYou can change the configuration and number of Shard nodes after the instance is created.
Shard Storage
Select a storage capacity for the Shard component. For more information about the storage capacity of the Shard component, see Sharded cluster instance storage.
NoteThis is the storage capacity per node, not the total for all nodes.
The storage capacity of the Shard component includes space for your data files, system files, and log files.
Shard Read-only Nodes
Select the number of read-only nodes for the sharded cluster instance. Valid values: 0 to 5. For more information, see Read-only nodes.
Shard Nodes
Select the number of Shard nodes in the instance. Valid values: 2 to 32.
NoteEach Shard node uses a three-node replica set architecture by default. To best use storage and compute resources, select two or more Shard nodes and configure data sharding. For more information, see Configure data sharding to make full use of shard performance.
A single sharded cluster instance supports a maximum of 32 Shard nodes by default.
Configserver Specifications
Select an instance type for the ConfigServer component. For more information about the supported instance types, see Sharded cluster instance types.
ConfigServer Storage
Select a storage capacity for the ConfigServer component. For more information about the storage capacity of the ConfigServer component, see Sharded cluster instance storage.
Username
Set to root.
NoteThis is the root account for the admin database. For more information about the permissions of the root account, see What permissions does the root account have?.
Password Settings
Set the password for the root account. You can select one of the following methods:
Set Now: Set the password immediately.
Set Later: Set the password after the instance is created. For more information, see (Optional) Reset a password.
Password
If you set the password now, it must meet these requirements:
Contain at least three of the following: uppercase letters, lowercase letters, digits, and special characters.
The following special characters are supported:
!@#$%^&*()_+-=Be 8 to 32 characters long.
Purchase Duration
If you create a subscription instance, select a subscription duration. You can select a monthly subscription for 1 to 9 months, or a yearly subscription for 1 Year, 2 Years, 3 Years, or 4 Years.
NoteTo enable auto-renewal for your instance, select the Auto-Renewal checkbox. Make sure that your account has a sufficient balance before the subscription expires.
Follow the steps for your selected billing method.
Billing method
Procedure
subscription
After you configure the parameters, click Buy Now.
On the Confirm Order page, check the configuration details and read the terms of service.
Click Payment and complete the payment on the Pay page.
NoteYou can also click Add to Cart to purchase the instance along with other products. For more information, see Shopping cart checkout.
pay-as-you-go
After you configure the parameters, click Buy Now.
On the Confirm Order page, check the configuration details and read the terms of service.
Click Activate Now. Fees are automatically deducted from your account in the next hour.
Verify the instance creation.
After you complete the payment, click Console to go to the ApsaraDB for MongoDB console.
In the upper-left corner of the page, select the resource group and region where the instance is located.
In the left-side navigation pane, click Sharded Cluster Instances.
Check whether the created instance appears in the instance list.
If the instance is in the list and its state is Running, the instance is created successfully.
If the instance does not appear, wait 10 to 15 minutes and refresh the page. If it is still missing, see the following table for troubleshooting. Contact Alibaba Cloud Technical Support if the issue persists.
The following table describes the possible causes and solutions.
Possible cause
Solution
An incorrect region is selected.
In the upper-left corner of the ApsaraDB for MongoDB console, select the resource group and region where the instance is located.
An incorrect instance list is selected.
In the left-side navigation pane of the ApsaraDB for MongoDB console, click Sharded Cluster Instances.
Insufficient resources
Your purchase may be refunded due to insufficient resources.
After confirming the refund, try creating an instance in a different zone.
Shopping cart checkout
If you purchase a subscription instance, you can click Add to Cart after you configure the parameters to purchase the instance along with other products.
Click the Shopping Cart icon on the right side of the page.
In the Shopping Cart panel, select the products that you want to purchase and click Go to Cart.
On the Shopping Cart page, confirm that your selected products are correct.
NoteYou can also change the Purchase Duration and Quantity of the ApsaraDB for MongoDB instance.
If the selection is correct, click Buy Now.
If the selection is incorrect, select the correct products and click Buy Now.
On the Confirm Order page, read the terms of service and click Buy.
On the Pay page, complete the payment as prompted.
Related APIs
API | Description |
| |
Query whether auto-renewal is enabled for an ApsaraDB for MongoDB instance. | |
Query the details of an ApsaraDB for MongoDB instance. |
Next steps
After creating the instance, complete the following steps:
Optional: If you did not set a password when you created the instance, set one. For more information, see (Optional) Reset a password.
Configure a whitelist for the instance to allow external devices to access it. For more information, see Configure a whitelist.
Optional: To connect to the instance over the internet, apply for a public endpoint. For more information, see (Optional) Apply for a public endpoint.