MongoDB Learning Note 34 MongoDB replica set design principles

Source: Internet
Author: User
Tags readable

There is an important concept in the replica set in MongoDB: most

Because the replica set has only one node that is readable and writable, the other nodes are readable only, and the selection of the master node is determined by the majority, and can continue as the primary node only if support is obtained.

(1) Most of the confirmation formula for this number: M=int ((N/2) +1)

* Most of the numbers are equal to greater than m, but less than or equal to n;n as the total number of servers in the replica set

(2) Once the majority is unavailable in a replica set, the entire replica set is unavailable and N/2 nodes fail for n is even, the entire replica set is invalidated;

Main node election mechanism:

(1) When the backup node is not connected to the primary node, it will contact other replica set members to elect itself as the primary node;

(2) The other members will do several checks first:

A. Is it connected to the master node itself?

B. Is the data for the backup node that you want to be elected as the primary node up to date?

C. Are there any other higher priority members that can be elected as the primary node?

(3) As long as a "majority" member voted against the vote, the election is rejected; only the candidate receives the "majority" member's affirmative vote, it becomes the main node.



This article is from the "Margin with Wish" blog, please be sure to keep this source http://281816327.blog.51cto.com/907015/1615019

MongoDB Learning Note 34 MongoDB replica set design principles

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.