ApsaraDB for MongoDB sharded cluster instances are suitable for scenarios in which a large number of high concurrency read and write operations must be processed. 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.
  • If you want to create a standalone instance that is charged based on the pay-as-you-go billing method, make sure that you have sufficient balance within your account.

Precautions

If your application is deployed on an Elastic Compute Service (ECS) instance, make sure that your sharded cluster instance and the ECS instance meet the following requirements to ensure network connectivity:
  • Your sharded cluster instance and the ECS instance belong to the same region. You can view the region of a created ECS instance. For more information, see View instance information.
  • Optional:Your sharded cluster instance and the ECS instance belong to the same zone. This reduces network latency. You can view the zone of a created ECS instance. For more information, see View instance information.
  • Your sharded cluster instance and the ECS instance reside in the same type of network. You can view the network type of a created ECS instance. For more information, see View instance information. If an ECS instance resides in the classic network, you can migrate the ECS instance from the classic network to a virtual private cloud (VPC). For more information, see Migrate an ECS instance from the classic network to a VPC.

Billing

ApsaraDB for MongoDB supports the subscription and pay-as-you-go billing methods. You can select a billing method based on your business requirements.
  • 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 configurations of the instance. Fees are automatically deducted from your Alibaba Cloud account.

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 interventions are required.

  1. Log on to the ApsaraDB for MongoDB console.
  2. In the upper-left corner of the page, select the resource group and the region of the target instance.
  3. In the left-side navigation pane, click Sharded Cluster Instances.
  4. On the Sharded Cluster Instances page, click Create Instance.
  5. Click the Sharded Cluster (Subscription) or Sharded Cluster (Pay-as-you-go) tab based on your business requirements.
  6. Configure the following parameters.
    Parameter Description
    Region The region where the sharded cluster instance is deployed.
    Note
    • After the sharded cluster instance is created, you cannot change the region of the instance. Proceed with caution.
    • If your application is deployed on an ECS instance, the sharded cluster instance and the ECS instance must belong to the same region. If the sharded cluster instance and the ECS instance belong to different regions, your application cannot communicate with the sharded cluster instance over an internal network.
    Zone The zone where the sharded cluster instance is deployed.
    Note
    • If your application is deployed on an ECS instance, we recommend that you make sure that the sharded cluster instance and the ECS instance belong to the same zone. This reduces network latency. If the zone that you select for the sharded cluster instance is different from the zone of the ECS instance, you can migrate the sharded cluster instance to the same zone as the ECS instance after the sharded cluster instance is created. For more information, see Migrate an ApsaraDB for MongoDB instance to different zones in the same region.
    • You can select multiple zones for the sharded cluster instance to implement zone-disaster recovery. For more information, see Create a multi-zone sharded cluster instance.
    Protocol Type The protocol type of the sharded cluster instance.
    • MongoDB
    • DynamoDB
    Database Version The MongoDB version of the sharded cluster instance. Valid values:
    • MongoDB 4.2
    • MongoDB 4.0
    • MongoDB 3.4
    Note
    • You can select only MongoDB 4.0 for sharded cluster instances that are compatible with the DynamoDB protocol.
    • When a sharded cluster instance is in the Running state, you can manually upgrade the MongoDB version of the instance. For more information, see Upgrade MongoDB versions.
    Storage Engine The storage engine of the sharded cluster instance. This value can be set only to WiredTiger.
    Network Type The type of network in which the sharded cluster instance resides. We recommend that you select VPC.
    • Classic Network: In the classic network, you can block unauthorized traffic only by configuring security groups or IP address whitelists.
    • VPC: A VPC is an isolated virtual network that provides higher security and higher performance than the classic network.
      Note
      • You can set the value only to VPC for pay-as-you-go sharded cluster instances that are compatible with the DynamoDB protocol.
      • If your application is deployed on an ECS instance, you must make sure that the ECS instance resides in a VPC. This ensures network connectivity between your application and the sharded cluster instance.
    VPC The ID of the VPC to which the sharded cluster instance belongs. If no VPCs are available, you can create a VPC in the VPC console. For more information, see Create and manage a VPC.
    Note
    vSwitch The ID of the vSwitch to which the sharded cluster instance is connected. If no vSwitches are available, you can create a vSwitch in the VPC console. For more information, see Work with vSwitches.
    Mongos Specification The specifications of each mongos node in the sharded cluster instance. For more information about the specifications that are supported by mongos nodes, see Instance types.
    Note When the sharded cluster instance is in the Running state, you can change the configurations and quantity of mongos nodes.
    Quantity The 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 select two or more mongos nodes to ensure high availability.
    Shard Type The specifications of each shard node in the sharded cluster instance. For more information about the specifications that are supported by shard nodes, see Instance types.
    Note When the sharded cluster instance is in the Running state, you can change the configurations and quantity of shard nodes.
    Shard Storage Capacity The storage space of each shard node in the sharded cluster instance.
    Note The storage space stores the data, system, and log files.
    readonly_replicas The number of read-only nodes. This parameter appears only when the sharded cluster instance is charged on a subscription basis. For more information about read-only nodes, see ApsaraDB for MongoDB read-only nodes.
    Quantity The 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 select two or more shard nodes to ensure a proper configuration of data shards. This way, the storage space and computing performance of shard nodes can be fully utilized. For more information, see Configure sharding to maximize the performance of shards.
    Config Server Type The specifications of the Configserver node in the sharded cluster instance. This value can be set only to 1 core and 2 GB memory.
    Config Server The storage space of the Configserver node in the sharded cluster instance. This value can be set only to 20 GB.
    Password The time at which you want to set the password of the root user. Valid values:
    Password The password of the root user. If you set the Password parameter to Set Password, you must set the password of the root user in compliance with the following rules:
    • The password must contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters. Special characters include

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

    • The password must be 8 to 32 characters in length.
    Validity The subscription period of the sharded cluster instance. This parameter appears only when the sharded cluster instance is charged on a subscription basis. Valid monthly subscription periods range from one month to nine months. Valid yearly subscription periods range from one year to five 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.
  7. Purchase the sharded cluster instance based on the billing method of the instance.
    Billing method Procedure
    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 Pay for orders in the cart.
    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.
  8. Check whether the sharded cluster instance has been 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. Check whether the created sharded cluster instance is in the sharded cluster instance list.
      • 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.
        Possible cause Solution
        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 belong to 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. In this case, your payment is refunded. Go to the Billing Management console and open the Orders page to check whether you receive a refund.

        After you confirm the refund, perform one of the following operations:
        • Select a different zone and try again.
        • Submit a ticket. To submit a ticket, go to the New Ticket page.

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 products that you want to buy and click Proceed to Checkout.
  3. On the Cart page, check whether the products that you want to buy are selected.
    Note You can also re-specify the Subscription Cycle and Quantity values.
    • Yes: Click Buy Now.
    • No: Select the products that you want to buy and click Buy Now.
  4. On the Confirm Order page, read MongoDB Sharded Cluster (Subscription) Service Agreement, select I have read and agreed to the terms, and then click Confirm Purchase.
  5. On the Purchase page, complete the payment as instructed.

Related operations

Operation Description
CreateShardingDBInstance
  • Creates an ApsaraDB for MongoDB sharded cluster instance.
  • Clones an ApsaraDB for MongoDB sharded cluster instance.
DescribeInstanceAutoRenewalAttribute Queries whether auto-renewal is enabled for an ApsaraDB for MongoDB instance.
DescribeDBInstanceAttribute Queries the detailed information of an ApsaraDB for MongoDB instance.

What to do next

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