ApsaraDB for MongoDB sharded cluster instances are suitable for scenarios in which a large number of high concurrency read and write operations are involved. This topic describes how to create a sharded cluster instance in the ApsaraDB for MongoDB console.

Prerequisites

An Alibaba Cloud account is created. For more information, see Sign up with Alibaba Cloud.

Precautions

If your application is deployed on an Elastic Compute Service (ECS) instance, make sure that your ApsaraDB for MongoDB instance and ECS instance meet the following requirements to ensure network connectivity: For more information about how to view ECS instance information, see View instance information.
  • Your ApsaraDB for MongoDB instance and ECS instance are deployed in the same region.
  • Your ApsaraDB for MongoDB instance and ECS instance use the same network type.
    Note
    • The same zone is recommended because the same zone reduces network latency.
    • VPC is recommended because VPC provides higher security.
    • If the network type is VPC, you must ensure that they use the same VPC ID.
    • If you want to use VPC, but the network type of the ECS instance is classic network, you can change the network type of the ECS instance to VPC. For more information, see Migrate ECS instances from the classic network to a VPC.

Limits

  • ApsaraDB for MongoDB instances that run MongoDB 4.2 or earlier can be created only in the following regions and zones:
    • China (Hangzhou): Hangzhou Zone G, Zone H, Zone I, Zone J, and Zone K
    • China (Shanghai): Shanghai Zone B, Zone D, Zone G, and Zone L
    • China (Qingdao): Qingdao Zone B and Zone C
    • China (Beijing): Beijing Zone E, Zone F, Zone H, Zone K, and Zone L
    • China (Zhangjiakou): Zhangjiakou Zone A, Zone B, and Zone C
    • China (Hohhot): Hohhot Zone A and Zone B
    • China (Ulanqab): Ulanqab Zone A, Zone B, and Zone C
    • China (Shenzhen): Shenzhen Zone A, Zone C, Zone D, Zone E, Zone F, and Zones (C + D + E)
    • China (Heyuan): Heyuan Zone A and Zone B
    • China (Guangzhou): Guangzhou Zone A
    • China (Chengdu): Chengdu Zone A and Zone B
    • China (Hong Kong): Hongkong Zone B, Zone C, Zone D, and Zones (B + C + D)
    • Singapore: Singapore Zone A, Zone B, Zone C, and Zones (A + B + C)
    • Australia (Sydney): Sydney Zone A and Zone B
    • Malaysia (Kuala Lumpur): Kuala Lumpur Zone A and Zone B
    • Indonesia (Jakarta): Jakarta Zone A, Zone B, and Zone C
    • Philippines (Manila): Manila Zone A
    • Japan (Tokyo): Tokyo Zone A, Zone B, or Zone C
    • India (Mumbai): Mumbai Zone A and Zone B
    • UAE (Dubai): Dubai Zone A
    • US (Silicon Valley): Silicon Valley Zone A and Zone B
    • US (Virginia): Virginia Zone A and Zone B
    • UK (London): London Zone A and Zone B
    • Germany (Frankfurt): Frankfurt Zone A, Zone B, and Zone C
  • ApsaraDB for MongoDB instances that run MongoDB 4.4 or later can be created only in the following regions and zones:
    • China (Hangzhou): Hangzhou Zone G, Zone H, and Zone I
    • China (Shanghai): Shanghai Zone B and Zone G
    • China (Qingdao): Qingdao Zone C
    • China (Beijing): Beijing Zone F and Zone H
    • China (Zhangjiakou): Zhangjiakou Zone A and Zone C
    • China (Hohhot): Hohhot Zone B
    • China (Ulanqab): Ulanqab Zone A, Zone B, and Zone C
    • China (Shenzhen): Shenzhen Zone E
    • China (Heyuan): Heyuan Zone A and Zone B
    • China (Chengdu): Chengdu Zone A and Zone B
    • China (Hong Kong): Hongkong Zone B, Zone C, and Zone D
    • Singapore: Singapore Zone A, Zone B, and Zone C
    • Malaysia (Kuala Lumpur): Kuala Lumpur Zone B
    • Indonesia (Jakarta): Jakarta Zone A, Zone B, and Zone C
    • Thailand (Bangkok): Bangkok Zone A
    • Japan (Tokyo): Tokyo Zone A, Zone B, or Zone C
    • South Korea (Seoul): Seoul Zone A
    • India (Mumbai): Mumbai Zone B
    • US (Silicon Valley): Silicon Valley Zone B
    • UK (London): London Zone A and Zone B
    • US (Virginia): Virginia Zone A and Zone B
    • Germany (Frankfurt): Frankfurt Zone A, Zone B, and Zone C

Billing

An Alibaba Cloud account is created. For more information, see Sign up with Alibaba Cloud.
  • Subscription: If you purchase a subscription instance, you must pay an upfront fee for the instance.
  • Pay-as-you-go: A pay-as-you-go instance is charged per hour based on the configuration of the instance. Fees are automatically deducted from your Alibaba Cloud account.
Note For more information, see Billable items and pricing.

Procedure

After you perform the following steps, ApsaraDB for MongoDB automatically creates one or more standalone instances. No manual operations are required.

  1. Log on to the ApsaraDB for MongoDB console.
  2. In the left-side navigation pane, click Sharded Cluster Instances.
  3. On the Sharded Cluster Instances page, click Create Instance.
  4. Set Product Type to Sharded Cluster (Subscription) or Sharded Cluster (Pay-as-you-go).
  5. Configure the parameters described in the following table.
    ParameterDescription
    RegionThe region where you want to deploy the instance.
    Note
    • After the instance is created, you cannot change the region of the instance. Proceed with caution.
    • If your application is deployed on an Elastic Compute Service (ECS) instance, we recommend that you deploy the instance in the region where the ECS instance resides. If the instance and the ECS instance belong to different regions, your application cannot connect to the instance over an internal network.
    Zone TypeThe zone type of the instance.
    • Single-zone: Mongos, shard, and Configserver nodes of a sharded cluster instance are deployed within one zone.
    • Multi-zone: Mongos, shard, and Configserver nodes of a sharded cluster instance are deployed across three different zones.
    Note ApsaraDB for MongoDB instances that run MongoDB 4.2 or earlier allow you to select only Single-zone. However, you can configure Zone to deploy the sharded cluster instance in multiple zones. To implement multi-zone deployment, you must select zones in the following format: Region (Zone 1 + Zone 2 + Zone 3). Example: Shenzhen Zone (C + D + E).
    ZoneThe zone where you want to deploy the instance.
    If you set Zone Type to Multi-zone, you must configure Secondary Zone 1 and Secondary Zone 2. Only the following zones are available for multi-zone deployment:
    • Hangzhou Zone G, Zone H, and Zone I
    • Shanghai Zone B, Zone G, and Zone L
    • Beijing Zone F, Zone H, Zone L, and Zone K
    • Shenzhen Zone D, Zone E, and Zone F
    • Hongkong Zone B, Zone C, and Zone D
    • Ulanqab Zone A, Zone B, and Zone C
    • Singapore Zone A, Zone B, and Zone C
    • Jakarta Zone A, Zone B, and Zone C
    • Frankfurt Zone A, Zone B, and Zone C
    • Tokyo Zone A, Zone B, or Zone C
    The following multi-zone deployment rules can be used for a sharded cluster instance:
    • Mongos nodes: Mongos nodes are evenly deployed across all data centers. The sharded cluster instance must contain at least two mongos nodes that are deployed across two different zones. When you add a third mongos node, the node is deployed in the third zone by default. Subsequent nodes to be added are deployed across the three zones in turn.
    • Shard nodes: The primary, secondary, and hidden nodes of a shard node are not deployed in the three zones in sequence. Node zones may change due to manual primary/secondary switchover or automatic HA switchover.
    • Configserver nodes: The primary, secondary, and hidden nodes of a Configserver node are deployed across the three different zones.
    Note If your application is deployed on an ECS instance, we recommend that you deploy the instance in the zone where the ECS instance resides to reduce network latency. If you use an instance that runs MongoDB 4.2 or earlier, you can migrate the instance to a different zone. For more information, see Migrate an ApsaraDB for MongoDB instance to different zones in the same region.
    Protocol TypeThe protocol type of the instance.
    • MongoDB
    • DynamoDB
    Note For more information about the DynamoDB protocol, see Compatibility details of DynamoDB-compatible ApsaraDB for MongoDB instances.
    Engine VersionThe MongoDB version of the instance.
    If you set Zone Type to Multi-zone, you can select only MongoDB 6.0, MongoDB 5.0, and MongoDB 4.4.
    Note
    • You can select only MongoDB 4.0 for sharded cluster instances that have the DynamoDB protocol type selected.
    • If the value of the Zone, Secondary Zone 1, or Secondary Zone 2 parameter that you select does not support the multi-zone deployment, the Engine Version parameter is not displayed. The sharded cluster instance cannot be created.
    • When an instance is in the Running state, you can manually upgrade the MongoDB version of the instance. For more information, see Upgrade the major version of an ApsaraDB for MongoDB instance.
    Storage EngineThe storage engine of the instance. This value can be set only to WiredTiger.
    Storage TypeThe storage type of the instance.
    • ESSDs come in the following three performance levels (PLs):
      • ESSD PL1: This is the basic PL of ESSDs.
      • ESSD PL2: An ESSD of PL2 delivers IOPS and throughput that are approximately two times the IOPS and throughput delivered by an ESSD of PL1.
      • ESSD PL3: An ESSD of PL3 delivers IOPS that is up to 20 times the IOPS delivered by an ESSD of PL1. An ESSD of PL3 also delivers throughput that is up to 11 times the throughput delivered by an ESSD of PL1. ESSDs of PL3 are suitable for business scenarios in which concurrent requests must be processed with high I/O performance and at low read and write latencies.
      Note For more information about performance comparison in terms of capacity range, maximum IOPS, and maximum throughput, see ESSDs.
    • Local SSD: A local SSD resides on the same host as the database engine. You can store data in local SSDs to reduce I/O latency.
    Network TypeThe type of network where you want to deploy the instance. This parameter can be set only to VPC.
    Note If your application is deployed on an ECS instance, you must make sure that the ECS instance is in a VPC. This ensures network connectivity between your application and the sharded cluster instance.
    VPCThe ID of the virtual private cloud (VPC) where you want to deploy the sharded cluster instance. If no VPCs are available, you can create a VPC in the VPC console. For more information, see Create and manage a VPC.
    Note
    vSwitchThe ID of the vSwitch to which the sharded cluster instance connects. If no vSwitches are available, you can create a vSwitch in the VPC console. For more information, see Create and manage a vSwitch.
    Mongos SpecificationThe specifications of each mongos node in the sharded cluster instance. For more information, see Sharded cluster instance types.
    Note When the sharded cluster instance is in the Running state, you can change the configurations and quantity of mongos nodes.
    Mongos QuantityThe number of mongos nodes in the sharded cluster instance. Valid values: 2 to 32.
    Note
    • By default, mongos nodes use the standalone architecture. We recommend that you specify two or more mongos nodes to ensure high availability.
    • A maximum of 32 mongos nodes can be added to each sharded cluster instance.
    Shard SpecificationsThe specifications of each shard node in the sharded cluster instance. For more information, see Sharded cluster instance types.
    Note When the sharded cluster instance is in the Running state, you can change the configurations and quantity of shard nodes.
    Shard StorageThe storage capacity of each shard node in the sharded cluster instance. For more information, see Sharded cluster instance types.
    Note
    • This parameter specifies the storage capacity of each node rather than the sum of the storage capacity of all nodes.
    • The storage capacity is used to store the data, system, and log files.
    Shard Read-only NodesThe number of read-only nodes in a shard node of the sharded cluster instance. Valid values: 0 to 5. For more information about read-only nodes, see Read-only nodes.
    Shard QuantityThe number of shard nodes in the sharded cluster instance. Valid values: 2 to 32.
    Note
    • By default, shard nodes use the three-node replica set architecture. We recommend that you specify two or more shard nodes to ensure a proper configuration of data shards. This way, the storage capacity and computing performance of shard nodes can be fully utilized. For more information, see Configure sharding to maximize the performance of shards.
    • A maximum of 32 shard nodes can be added to each sharded cluster instance.
    ConfigServer SpecificationThe specifications of the Configserver node in the sharded cluster instance. For more information, see Sharded cluster instance types.
    ConfigServer StorageThe storage capacity of the Configserver node in the sharded cluster instance. For more information, see Sharded cluster instance types.
    Set PasswordThe time when you want to set the password of the root account. Valid values:
    • Set Now: You want to immediately set the password of the root account.
    • Set Later: You want to set the password of the root account after the sharded cluster instance is created. For more information, see (Optional) Reset a password.
    PasswordThe password of the root account. If you set the Set Password parameter to Set Now, you must set the password of the root account when you create the sharded cluster instance. You must set the password in compliance with the following rules:
    • The password must contain at least three of the following character types: uppercase letters, lowercase letters, digits, and specific special characters.

      Special characters include ! @ # $ % ^ & * ( ) _ + - =

    • The password must be 8 to 32 characters in length.
    DurationThe subscription duration of the sharded cluster instance. This parameter is displayed only when you specify to create a subscription instance. Valid values: 1 Month, 2 Months, 3 Months, 4 Months, 5 Months, 6 Months, 7 Months, 8 Months, 9 Months, 1 Year, 2 Years, 3 Years, 5 Years.
    Note If you want to enable auto-renewal for the sharded cluster instance, select Auto-renewal and make sure that you have sufficient balance within your account before the system automatically renews the instance.
  6. Complete the payment based on the billing method of the instance.
    Billing methodProcedure
    Subscription
    1. Complete the parameter settings and click Buy Now.
    2. On the Confirm Order page, check the parameter settings. Then, read MongoDB Sharded Cluster (Subscription) Agreement of Service and select I have read and agree to MongoDB Sharded Cluster (Subscription) Agreement of Service.
    3. Click Pay. On the Purchase page, complete the payment.
    Note You can also click Add to Cart to pay for orders in the cart in a lump sum. For more information, see the "Pay for orders in the cart" section of this topic.
    Pay-as-you-go
    1. Complete the parameter settings and click Buy Now.
    2. On the Confirm Order page, check the parameter settings. Then, read MongoDB Sharded Cluster (Pay-as-you-go) Agreement of Service and select I have read and agree to MongoDB Sharded Cluster (Pay-as-you-go) Agreement of Service.
    3. Click Activate Now. The system collects the amount due within the next hour.
  7. Check whether the sharded cluster instance is created.
    1. After you complete the payment, click Console to go to the ApsaraDB for MongoDB console.
    2. In the upper-left corner of the page, select the resource group and region to which the sharded cluster instance belongs.
    3. In the left-side navigation pane, click Sharded Cluster Instances.
    4. In the instance list that appears, check whether the sharded cluster instance that you created is displayed.
      • If the sharded cluster instance is displayed, the instance is created. If the sharded cluster instance is in the Running state, the instance is running as expected.
      • If the sharded cluster instance is not displayed, wait for 10 to 15 minutes. Then, refresh the page. If the sharded cluster instance is still not displayed, check whether the issues that are described in the following table occur. If none of the issues occur, contact Alibaba Cloud technical support.
        The following table describes the possible causes of and solutions to the issues due to which the created sharded cluster instance is not displayed.
        CauseSolution
        The sharded cluster instance does not belong to the region that you select.In the upper-left corner of the ApsaraDB for MongoDB console, select the resource group and region to which the sharded cluster instance belongs.
        The sharded cluster instance does not use the instance architecture that you select.In the left-side navigation pane of the ApsaraDB for MongoDB console, click Sharded Cluster Instances.
        The sharded cluster instance is not created due to insufficient resources.

        The system may fail to create the instance due to insufficient resources.

        After you confirm that the payment is refunded, try to create a sharded cluster instance in another zone.

Pay for orders in the cart

If you want to purchase a subscription sharded cluster instance, you can also click Add to Cart to pay for orders in the cart in a lump sum after you complete the parameter settings. You can perform the following steps to pay for orders in the cart:
  1. In the lower-right corner of the page, click the Cart icon.
  2. In the Cart panel, select the orders that you want to pay and click Proceed to Checkout.
  3. On the Cart page, check whether the orders that you want to pay are selected.
    Note You can also reset the Subscription Cycle and Quantity parameters.
    • If the orders for which you want to pay are selected, click Buy Now.
    • Otherwise, select the orders and click Buy Now.
  4. On the Confirm Order page, read and select the terms of service and click Confirm Purchase.
  5. On the Purchase page, complete the payment.

Related API operations

OperationDescription
CreateShardingDBInstance
  • Creates an ApsaraDB for MongoDB sharded cluster instance.
  • Clones an ApsaraDB for MongoDB sharded cluster instance.
DescribeInstanceAutoRenewalAttributeQueries whether auto-renewal is enabled for an ApsaraDB for MongoDB instance.
DescribeDBInstanceAttributeQueries the detailed information of an ApsaraDB for MongoDB instance.

What to do next

After the sharded cluster instance is created, perform the following operations: