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.
For details about the mongod process, see the MongoDB official documentation.
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 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 replica set is created, you can add up to either 5 or 7 nodes. For details about how to add a replica set node, see Adding 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.