Graphic MongoDB principle

Source: Internet
Author: User
Tags mongodb
MongoDB is a very common document-oriented, non-relational database, mainly used in microblogging, blog, IM, and other message storage business, because the storage data and finance and other industries is not so important, and no requirements for business, so in this scenario, MongoDB is more appropriate than a relational database, because the traditional relational database each operation will have an ACK, and MongoDB design removed this step, greatly improve the performance of the storage, and MongoDB design takes into account the frequent occurrence of equipment failure scene, Therefore, the design of disaster tolerance and failover aspects of the program.
MongoDB (Vice) This set and fragmentation:
The data stored in each complex (vice) set is the same, which is equivalent to data redundancy in the primary standby mode, and is intended for disaster tolerance.

Fragmentation is to expand the data, according to the key to the node partition, the data according to the key storage to the corresponding server.

MongoDB Deployment Scenarios

There are three types of roles in the MongoDB Cluster deployment scenario: The actual data storage node, the configuration file storage node, and the Routing access node. The connected client connects directly with the routing node, queries the data from the configuration node, and queries and stores the data based on the query results to the actual storage node. The MongoDB deployment scenario is a stand-alone deployment, replica set (primary) deployment, fragmentation deployment, replica set, and fragmentation mix deployment.

A mixed deployment approach is shown in figure:


The process of writing data to MongoDB in a mixed deployment mode is shown in figure:


Mixed deployment mode to read the data flow in the MongoDB as shown:


For a replica set, there are also two roles, the write data and the read data are different, the process of writing the data is only written to the main node, from the main node asynchronously synchronized to the node from the point:


Read data is only read from any node, specific to which node read can be specified:


For MongoDB fragmentation, suppose we take an index key (ID) as the slice key, the ID interval [0,50], divided into 5 chunk, respectively, stored in the 3-piece server, as shown in the figure:


If the data volume is very large, need to increase the chip server can only move chunk to divide the data equally.

To configure a node:

The server that stores the configuration file actually stores the key and chunk and the mapping relationship between the chunk and the server, using the data model represented by the configuration node as shown above:


Routing node:

The node of the routing role plays the role of load balancing in the case of fragmentation.

To learn more in detail MongoDB please read "MongoDB Authority Guide" "In-depth study MongoDB" "MongoDB Combat"

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.