ApsaraDB for MongoDB automatically creates 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

Node | Feature | Description |
---|---|---|
Primary node | The node that performs 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 oplogs. If the primary node fails, a secondary node can be elected as the new primary node to ensure high availability. | 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 oplogs. If a secondary node fails, the hidden node can be elected as a new secondary node to ensure high availability. |
|
Read-only node | Read-only nodes can be used to relieve read pressure on the primary and secondary nodes in business scenarios where a large number of read requests exist. For more information, see ApsaraDB for MongoDB read-only nodes. | Read-only nodes are not displayed in the secondary node list and cannot be elected as the primary node. It does not participate in election for the primary node. |
Scale out 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 on these websites or systems may surge due to impromptu events. In these scenarios, you can add or remove secondary nodes or read-only nodes to adjust the read capability of your replica set instance.