ApsaraDB for MongoDB automatically configures replica set instances. You can manage the primary node and secondary nodes of a replica set instance. Replica set instances provide advanced features such as disaster recovery and failover. When you use replica set instances, the advanced features are enabled by default.

Architecture

Architecture of ApsaraDB for MongoDB replica set instances
ApsaraDB for MongoDB uses a multi-node architecture to achieve high availability. A replica set instance consists of a primary node, one or more secondary nodes, and a hidden node.
  • Primary node: The primary node processes all read and write operations. Each replica set instance contains only one primary node.
  • Secondary node: A secondary node synchronizes data from the primary node by using operational logs. If the primary node fails, a secondary node can be elected as the new primary node to ensure high availability.
    Note If you connect to a replica set instance by using the connection string of a secondary node, you can only read data from the instance. You cannot write data to the instance.
  • Hidden node: The hidden node synchronizes data from the primary node by using operational logs. If a secondary node fails, the hidden node can be elected as a new secondary node to ensure high availability.
    Note The hidden node is used only to ensure high availability. It is invisible to users.

Scale out a replica set instance

ApsaraDB for MongoDB allows you to add secondary nodes to a replica set instance based on your business requirements. For more information, see A new version is available..
Note Each replica set instance contains only one hidden node. You can scale out a replica set instance only by adding secondary nodes to the instance. You cannot add hidden nodes to a replica set instance.

For example, you run websites that provide online reading services or run systems that provide order queries. These websites and systems process a large number of read operations and a small number of write operations. In addition, the number of operations in these websites or systems may surge due to impromptu events. In these scenarios, you can add or remove secondary nodes to adjust the read capability of your replica set instance.