MongoDB replication set: Concepts and characteristics

Source: Internet
Author: User
Tags mongodb



the concept of a replica set

The replica set (also known as the replica set Replica set) is the master-slave cluster with automatic failure recovery.

The most obvious difference between the traditional master-slave structure and the replication set is that the replica set has no fixed "master node": The entire node elects a "master" and changes to the other node when it is not working. The replica set always has an active node (primary) and one or more backup nodes (secondary)

For MongoDB in data disaster, the recommended mode is to use the replica set pattern, but the traditional master-slave structure and the replication set are compared with some of the "use":

"There can be only 7 data nodes in the replication set for election" (MongoDB 2.6 version)

Although the method of replicating node properties can be modified, the replication set node can be increased to 12, but the remaining 5 nodes cannot provide services and can only be used as data redundancy. So when a production environment needs more than 11 nodes, we can use the traditional master-slave structure, because the master-slave structure from the number of nodes is unlimited.

When the replication set supports more than 11 data nodes that can provide services, it is officially recommended that the master-slave structure be "enabled" immediately. but in More than 50 copies of the MongoDB3.0 version are supported.

characteristics of a replica set

The main features of the replica set are the following four points:

The Lord is unique, but not fixed.

Guaranteed data consistency by most principles

Unable to write from library (by default, no driver connection is used and cannot be queried)

Compared with the traditional master-slave structure, the replication set can automatically tolerate disaster.

replica set member classification

Any time active node (also known as the Master node) has only one, others are backup nodes, and the specified active nodes can change over time. There are several different types of nodes that exist in the replica set:

Standard (Standard)

This is a regular node that stores a complete copy of the data, participates in voting, and is likely to become an active node

Passive (passive)

Storing the full copy of the data, participating in the voting, cannot become an active node.

Arbiter (vote)

The quorum node only participates in voting, does not receive replicated data, and cannot become an active node.

Each participating node (non-arbitrator) has a priority, priority (priority) is 0 is passive, cannot become an active node, the priority is not 0, according to the selection of active nodes from large to small, the same priority value to see who's data relatively new.

differentiate by whether or not to store data:

Data node: A node that holds data (entity physical files *.ns *.0, etc.), including the master node and the from node

Polling node: Do not deposit data, only election and replication set node

differentiate by function:

Master node: active node providing read and write services

From a node: a node that provides read services

Delay node: Delayed replication node (priority=0hidden=true slavedelay=xx)

Hidden node: not visible to Application (priority=0 hidden=true)

Polling node: node with voting rights, not arbiter (priority=0)

Polling node: Arbiter node, no data, only elections and acts as a replica set node, also known as election node.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.