Getting started

Updated at:

This topic describes how to create an ApsaraDB for MongoDB instance, connect to the instance, and read data from the instance or write data to the instance.

Deployment architectures

ApsaraDB for MongoDB supports flexible deployment architectures to meet various business requirements.

Architecture

Description

Scenarios

Standalone architecture

A standalone instance provides only one StandAlone node that is used to read and write data.

Suitable for development, testing, training, learning, and scenarios where non-core enterprise data is stored.

Replica set architecture

A replica set instance provides a primary node that supports read/write operations, one, three, or five secondary nodes for high availability, a hidden node, and zero to five optional read-only nodes. You can add or remove secondary nodes and read-only nodes based on your business requirements to better scale read performance.

Suitable for scenarios that require significantly more read operations than write operations or temporary burst activities.

Sharded cluster architecture

A sharded cluster instance consists of multiple replica sets (each replica set contains three nodes in primary/secondary mode and zero to five read-only nodes). It provides three components: mongos, shard, and ConfigServer. You can freely choose the number and specifications of mongos and shard components to infinitely scale performance and storage capacity, creating sharded cluster instances with different capabilities.

Suitable for scenarios that require highly concurrent read/write operations.

Billing methods

Billing methodDescription
Subscription
  • This is a prepaid method. You pay for the instance when you purchase it.
  • Subscription instances can be converted to pay-as-you-go instances. For more information, see Convert a subscription instance to a pay-as-you-go instance.
  • This method is ideal for long-term needs and is more cost-effective than pay-as-you-go. The longer the subscription duration, the larger the discount.
Pay-as-you-go
  • This is a postpaid method. A bill is generated each hour. The fee is deducted from your Alibaba Cloud account based on the instance type and the maximum storage space used during the billing cycle.
    Note ApsaraDB for MongoDB offers storage plans and compute plans that can be used to offset the storage and instance type costs for pay-as-you-go replica set instances. For more information about storage and compute plans, see Storage plans and Compute plans.
    • The billing cycle is one hour. Usage for less than one hour is billed as a full hour.
    • If you change the storage space of an instance within a billing cycle, you are billed based on the maximum storage space value used during that cycle.

      Example:

      For the billing cycle from 01:00:00 to 02:00:00 (UTC+8), assume your storage space is 1 GB at 01:10:00. You change it to 8 GB at 01:20:00, and then to 2 GB at 01:50:00. For this billing cycle, you are charged for 8 GB of storage.

    • Bills are usually generated within one hour after a billing cycle ends. This process can take up to three hours. The actual time of bill generation is determined by the system.

      Example:

      The bill for the 09:00:00 to 10:00:00 (UTC+8) cycle is generated before 11:00:00.

  • Pay-as-you-go instances can be converted to subscription instances. For more information, see Convert a pay-as-you-go instance to a subscription instance.
  • This method is ideal for short-term needs. You can release the instance immediately after use to save costs. For more information about how to release an instance, see Release an instance.
    Important After a pay-as-you-go instance is released, you are no longer charged for it.

Procedure

  1. Create an instance.

  2. Configure a whitelist.

  3. Connect to the instance.

  4. Write data.