A replica set consists of a set of mongod processes and provides a collection of data nodes to ensure data redundancy and reliability.
For details about the mongod process, visit https://docs.mongodb.com/v3.2/tutorial/manage-mongodb-processes/index.html.
A replica set consists of three nodes: primary, secondary, and hidden. The three-node architecture is automatically set up, and the three nodes synchronize data with each other automatically to ensure data reliability.
You can directly perform operations on the primary and secondary nodes. If a primary node goes down or becomes faulty, a secondary node is automatically assigned to the primary role and continues normal operation. If a secondary node is unavailable, a hidden node will take the role of the secondary to ensure high availability. The following figure shows the replica set architecture.