1. Official website: https://docs.mongodb.org/manual/tutorial/deploy-replica-set-for-testing/
2, Replica set Introduction: https://docs.mongodb.org/manual/core/replica-set-members/
3. Briefly describe what is replica Set:
If we use a single MongoDB database, then there will be a single point of failure and so on, MongoDB allows us to make a number of single MongoDB database ("Cluster replica Set") to provide a unified service.
("Cluster replica Set") has the following characteristics:
1: Data synchronization between nodes automatically, that is, the data between nodes is consistent.
2: Inter-node Health check, failure automatic switch, no impact on the client.
("Cluster replica Set") Role:
1, the primary node (primary) is responsible for receiving client read and write requests.
2. The secondary node (secondary) automatically replicates the data from the primary node, and can handle the client's read request (which must not be processed by the client).
("Cluster replica Set") runs the process:
1, the master node (primary) records all the operations to their own log, the secondary node (secondary) will automatically go to the Master node copy log, and then synchronize the data changes to their own database, so as to ensure data consistency.
2, if the primary node (primary) in the cluster fails, then the remaining secondary node (secondary) will automatically elect a new master node, such as.
3, if the original failure of the primary node and recovery is available, then he will join the cluster, then he will become a secondary node (secondary), and then immediately go to the current master node synchronization data, so that the formation of a new cluster, is not very powerful.
Learn MongoDB (ii) Replica set cluster configuration