Replica Set
A replica set consists of a set of mongod processes. It is a collection of nodes that help ensure data redundancy and reliability.
A replica set consists of three nodes: primary, secondary, and hidden. The three-node architecture is set up automatically, and the three nodes automatically synchronize data with each other to ensure data reliability. Replica sets are recommended for small- and medium-sized service systems that require high availability.
- Primary node: Primary nodes are used to process both read and write requests.
- Secondary node: Secondary nodes are used to process read requests only.
- Hidden node: Hidden nodes are used to back up service data.
You can perform operations on the primary and secondary nodes. If the primary node is faulty, the system automatically selects a new primary node. The following figure shows the replica set architecture.

After a three-node replica set instance is created, you can add nodes up to either 5 or 7. The newly added nodes are secondary nodes. For details about how to add nodes for a replica set instance, see Changing Replica Set Instance Nodes.

Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.