All Products
Search
Document Center

ApsaraDB for MongoDB:Getting started

Last Updated:Nov 12, 2024

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 the requirements of different business scenarios. The following section describes the architectures:

  • Architecture of standalone instances

    Standalone instances apply to development, testing, education, and scenarios where non-core enterprise data is stored. You can select the instance specifications that are most suitable for your business scenarios to minimize costs. For more information, see Standalone instances.

  • Architecture of replica set instances

    Replica set instances are suitable for 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 and 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 nodes and read-only nodes based on your business needs. For more information, see Replica set instances.

  • Architecture of sharded cluster instances

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

Procedure

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

  2. Optional:Set a password. If you did 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, you must add the IP addresses of these devices to the whitelist of your instance. For more information, see the following topics:

  4. Optional:Apply for a public endpoint. If you want 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 instance

    Replica set instance

    Sharded cluster instance

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

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