Community Blog How to Set up and Configure a Sharded Architecture ApsaraDB for MongoDB Instance

How to Set up and Configure a Sharded Architecture ApsaraDB for MongoDB Instance

This article explains how to set up and configure a shared architecture ApsaraDB for MongoDB Instance.

By Kelvin Galabuzi

What Is ApsaraDB for MongoDB?

Alibaba Cloud ApsaraDB for MongoDB is a secure and elastically scalable MongoDB database service. The service is relatively easy-to-setup. In addition, Alibaba Cloud handles most of the database server administration tasks, letting you focus on the core functioning of your applications.

Alibaba Cloud offers a two-month Enterprise free trial to set up a new ApsaraDB for MongoDB.

ApsaraDB for MongoDB Features

  • Flexible Architecture: ApsaraDB for MongoDB supports standalone instances, sharded architecture instances, and replica set architecture instances for MongoDB.
  • Automated Backup and Recovery: ApsaraDB for MongoDB enables the automatic backing up of data at multiple intervals. This ensures business continuity by enabling you to restore your data to the available checkpoints.
  • Anti-DDOS: ApsaraDB for MongoDB is built with Anti-DDOS capabilities to ensure traffic is monitored in real-time to filter legitimate traffic from non-legitimate traffic. This works with IP address whitelisting to provide access only from the allowed locations.
  • Integration with Data Transmission Service: ApsaraDB for MongoDB supports the transmission of data between on-premises databases and cloud databases. The service also supports data synchronization among multiple ApsaraDB for MongoDB instances.
  • Enhanced Operations and Management Capabilities: ApsaraDB for MongoDB provides an easy-to-use monitoring platform to analyze CPU Utilization, IOPS, connections, and disk space. This feature allows you to monitor multiple ApsaraDB for MongoDB instances within a single control plane. Additionally, you can efficiently perform database kernel version management.

What Is a Sharded Architecture for ApsaraDB for MongoDB?

Before discussing the sharding architecture, we need to understand the different database partitioning strategies:

  • Horizontal Partitioning: This is the practice of separating a table's rows into multiple tables, also known as partitions. Each partition has the same schema and columns, and the data held in each partition is different from the data in other partitions.
  • Vertical Partitioning: This is the practice of separating a table's columns into multiple tables. The data in vertical partitions are independent of the other, and each partition has distinct rows and columns.

The sharding database architecture (horizontal partitioning) separates one table's rows into multiple tables. Each partition (table) has the same schema and columns, and the data is independent of the data in other partitions.

Within' the sharding architecture, data is broken down into shards, also known as logical shards, which are separated across multiple nodes, also known as physical shards. This ensures faster and easier scaling of databases and provides data security and integrity.

Alibaba Cloud ApsaraDB for MongoDB Sharded architecture consists of three major components:

  • Mongos: The Mongos route reads and writes to the corresponding shards. You can purchase multiple Mongos for load balancing and failover purposes.
  • Shard: The shard stores the database data, and you can implement multiple shards to scale out the capacity of data storage and concurrent read/write operations.
  • Config Server: The config server stores the metadata for clusters and shards.

Setting up and Configuring a Sharded Architecture ApsaraDB for MongoDB Instance

The following section will cover how to set up and configure a sharded architecture ApsaraDB for MongoDB Instance:

  • Step 1: In the Alibaba Cloud console, access the NoSQL Databases section and then access the ApsaraDB for MongoDB service:


  • Step 2: On the ApsaraDB for MongoDB console, select the Sharded Cluster Instances blade and then click Create Instance:


  • Step 3: Select your Product type and its billing model, Region, Zone, Protocol type, Database version, and Storage engine:


  • Step 4: Select the Storage type, VPC, vSwitch, Mongos specification, and Mongos quantity:


  • Step 5: Select the Instance specification, Shard storage, Shard quantity, Config server specification, and Config server storage:


  • Step 6: Set the password for the root user and click Buy Now:


  • Step 7: Accept the Terms of Service and click Activate Now:


  • Step 8: After a few minutes, the new sharded architecture Apsara for MongoDB Instance will appear in the console:


  • Step 9: Configure the whitelist to include the Trusted IP Ranges that can access your ApsaraDB for MongoDB:


  • Step 10: Add the IP ranges to your new whitelist:

Note: We recommend not adding an IP range of on production systems; only enable access from trusted IP ranges.


  • Step 11: Click Log On and select the database shard to which you would like to connect:


  • Step 12: The Data Management Service will load in a different tab. Select your MongoDB database instance, insert the Database Account name and Password, and click Login:


  • Step 13: Finally, you can start working with the ApsaraDB for MongoDB instance using the Alibaba Cloud Data Management Service or any other MongoDB client connectivity tool:


0 0 0
Share on

Alibaba Cloud Community

689 posts | 133 followers

You may also like


Alibaba Cloud Community

689 posts | 133 followers

Related Products