MongoDB Copy Consolidation Dimension Summary

Source: Internet
Author: User
Tags mongodb

The previous article describes the MongoDB replica set and shard cluster practices, and below provides a small summary of the daily maintenance operations of the MongoDB cluster:

mongdb replica set failover feature benefits from its electoral mechanism. The election mechanism uses the bully algorithm, which makes it easy to select the master node from the distributed node. Bully algorithm is a coordinator (master node) campaign algorithm, the main idea is that each member of the cluster can declare that it is the primary node and notify other nodes. Other nodes can choose to accept this claim or reject it and enter the master node to compete. A node that is accepted by all other nodes can become the primary node. The node follows some attributes to determine who should win. This property can be a static ID, or it can be an updated metric like the last transaction ID (the newest node wins). 1) Number of nodes in the MongoDB cluster the number of members of the MongoDB replica set is officially recommended and the number of nodes required to participate in the election must be greater than half the number of members. If the MongoDB cluster has 3 nodes, then as long as 2 nodes alive can be elected, if there are 5, then live 3 nodes can be elected, if there are 7 nodes, then live 4 can be elected .... A MongoDB cluster allows up to 12 replica set nodes, with up to 7 nodes participating in the election. This is to reduce heartbeat requests for network traffic and election call time, and the heartbeat is sent every 2 seconds. MongoDB cluster up to 12 replica set nodes because there is no need for a copy of the data so many copies, too much backup to increase the network load and slow down the cluster performance, and up to 7 nodes to participate in the election because the internal election mechanism of the number of nodes too much will lead to the selection of the main node within 1 minutes, everything as appropriate. 2) MongoDB heartbeat the entire MongoDB cluster needs to maintain a certain amount of communication to know which nodes are alive and which nodes are hanging off. The MongoDB node sends the pings packet once every two seconds to the other nodes in the replica set, and if the other node does not return within 10 seconds, it is marked as unreachable. A State mapping table is maintained inside each node to indicate what the current role, log timestamp, and other key information is for each node. If it is a master node, in addition to maintaining the mapping table, you also need to check whether you can communicate with most of the nodes in the cluster, if you cannot downgrade yourself to a secondary read-only node. 3) MongoDB Synchronous MongoDB Replica set synchronization is divided into initialization synchronization and keep replication. Initialization synchronization refers to the full amount of synchronization data from the master node, if the primary node data volume is longer than the large synchronization time. While keep replication refers to the synchronization of the initialization, the real-time synchronization between nodes is generally incremental synchronization. Initialization synchronization is not only punished for the first time, there are two scenarios that trigger: [1] Secondary first time, this is for sure. [2] Secondary the amount of data behind the Oplog is larger than the size of the volume, so it will be copied in full. 

  

MongoDB Copy Consolidation Dimension Summary

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.