Cette page n'est pas encore disponible dans votre langue. Nous nous efforçons d'ajouter d'autres langues. Nous vous remercions de votre compréhension.

On this page

Show all

Replica Set

Updated on 2022-12-14 GMT+08:00

A replica set consists of a set of mongod processes. It is a collection of nodes that help ensure data redundancy and reliability.

NOTE:

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.

Figure 1 Three-node 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.

Figure 2 Replica set instance nodes
Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback