ApsaraDB for MongoDB sharded cluster instances are suitable for scenarios in which a large number of highly concurrent read and write operations must be processed. This topic describes how to create a sharded cluster instance in the ApsaraDB for MongoDB console.

Prerequisites

  • You are registered with Alibaba Cloud. For more information, see Sign up with Alibaba Cloud.
  • If you want to create standalone instances that are charged based on the pay-as-you-go billing method, the balance in your Alibaba Cloud account is sufficient.

Billing

ApsaraDB for MongoDB supports the subscription billing method and the pay-as-you-go billing method. 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 configuration of the instance. Fees are automatically deducted from your Alibaba Cloud account.

For more information, see Billable items and pricing.

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.

Procedure

After you perform the following steps, ApsaraDB for MongoDB automatically creates a sharded cluster instance. No manual intervention is 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) tab or Sharded Cluster (Pay-as-you-go) tab based on your business requirements.
  6. Configure the following parameters.
    Section Parameter Description
    Basic Configuration Region The region to which the sharded cluster instance belongs.
    Note
    • After the sharded cluster instance is created, you cannot change the region of the instance. Proceed with caution when you select a region.
    • 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 to which the sharded cluster instance belongs.
    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 helps you reduce 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.
    Database Version The MongoDB version of the sharded cluster instance. Valid values:
    • MongoDB 4.2
    • MongoDB 4.0
    • MongoDB 3.4
    Note 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.
    Network Type 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 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 ID 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 a VPC.
    Note
    VSwitch ID The ID of the vSwitch to which the sharded cluster instance belongs. If no vSwitches are available, you can create a vSwitch in the VPC console. For more information, see Create a vSwitch.
    Mongos Specification 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 configuration and quantity of mongos nodes.
    Quantity The number of mongos nodes in the sharded cluster instance. Valid values: 2 to 32.
    Shard Specifications 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 configuration and quantity of shard nodes.
    Storage Space The storage capacity of each shard node in the sharded cluster instance.
    Note The storage capacity is used to store your data files, system files, and log files.
    Quantity The number of shard nodes in the sharded cluster instance. Valid values: 2 to 32.
    Configserver Specifications Config Server Type The specifications of the Configserver node. The specifications are fixed to 1 core and 2 GB of memory.
    Config Server The storage capacity of the Configserver node. The storage capacity is fixed to 20 GB.
    Set Password Password The time when you want to set the password of the root account. Valid values:
    Password The password of the root account. If you set the Password parameter to Set Password, you must set the password of the root account in compliance with the following rules in this step:
    • The password must contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters. The password can contain the following special characters:

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

    • 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.
  7. Confirm the order and complete the payment.
    1. Confirm the parameter settings and click Buy Now.
    2. On the Confirm Order page, confirm the parameter settings, read and select ApsaraDB for MongoDB Agreement of Service, and then complete the payment.
  8. 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 minutes 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 type of instance 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.

        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:

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 details about an ApsaraDB for MongoDB instance.

What to do next

After standalone instances are created, perform the following operations:
  • Optional:If you did not set the password of the root user for the standalone instances when you created the instances, set the password of the root user. For more information, see Reset the password.
  • Configure IP address whitelists for the standalone instances. The IP address whitelists of a standalone instance contain the IP addresses or CIDR blocks that are granted access to the standalone instance. For more information, see Configure a whitelist for an ApsaraDB for MongoDB instance.
  • Optional:If you want to connect to a standalone instance over the Internet, apply for a public endpoint for the standalone instance. For more information, see Apply for a public endpoint for an ApsaraDB for MongoDB instance.