All Products
Search
Document Center

ApsaraDB for MongoDB:Getting started

Last Updated:Apr 30, 2025

This topic describes how to create an ApsaraDB for MongoDB instance, configure the instance information, and connect to the instance.

Deployment architectures

ApsaraDB for MongoDB supports multiple flexible deployment architectures to meet business scenario requirements. Architectures:

  • Standalone architecture

    This architecture applies to development, testing, education, and scenarios where non-core enterprise data is stored. You can select the instance specifications that best suit your business scenarios to minimize costs. For more information, see Standalone instances.

  • Replica set architecture

    This architecture suits burst traffic scenarios that require significantly more reads than writes or temporary activities. A replica set instance consists of a primary node that supports read/write operations, one, three, or five high-availability secondary nodes, a hidden node, and up to five optional read-only nodes. You can add or remove secondary and read-only nodes based on your business requirements. For more information, see Replica set instances.

  • Sharded cluster architecture

    This architecture suits scenarios that require highly concurrent read/write operations. A sharded cluster instance consists of multiple three-node replica sets. Each replica set contains three nodes in primary/secondary mode and up to five optional read-only nodes. A sharded cluster instance consists of three components: mongos, shard, and ConfigServer. You can specify the number and specifications of mongos nodes and shards to create sharded cluster instances that have different service capabilities. For more information, see Sharded cluster instances.

Procedure

The following flowchart shows all required operations, from purchasing an instance to using it.

Flowchart

  1. Create an instance. For more information, see the following topics:

  2. Optional:Set a password. If you do not set a password during instance creation or have forgotten your password, set or reset a password. For more information, see the following topics:

  3. Configure a whitelist. To allow external devices to access your instance, add the IP addresses of these devices to a whitelist of your instance. For more information, see the following topics:

  4. Optional:Apply for a public endpoint. To connect to your instance by using a public endpoint, first apply for a public endpoint for the instance. For more information, see the following topics:

  5. Connect to the instance. For more information, see the topics listed in the following table.

    Architecture

    References

    Standalone

    Replica set

    Sharded cluster

  6. Optional:Create a database account and grant it permissions. We recommend that you do not use the root account to connect to the instance in a production environment. You can create another database account and grant it permissions to connect to the instance. For more information, see the following topics:

  7. Create a database and a collection and write data to them. For more information, see the following topics: