Diagram of MongoDB principle

Source: Internet
Author: User

MongoDB is a very common document-oriented non-relational database, mainly used in micro-blogging, blog, IM and other message storage business, because the data stored in the financial industry and other industries are not so important, and there is no need for transactions, so in this scenario, MongoDB is more suitable than 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 situation of equipment failure often appear, Therefore, in the design of disaster tolerance and failover scenarios.
MongoDB Complex (sub) This set and shard:
Each complex (secondary) stored in the centralized data is the same, the equivalent of the primary and standby data redundancy, the purpose is to disaster.

The Shard is for the data expansion, according to the chip key to divide the node, the data is stored according to the chip key to the corresponding server.

MongoDB Deployment Scenarios

There are three types of roles in MongoDB's cluster deployment scenario: Actual data storage nodes, configuration file storage nodes, and routed access nodes.

the connected client connects directly to the routing node, querying the data from the configuration node and querying and storing the data based on the results of the query to the actual storage node. MongoDB's deployment scenario has a single-machine deployment, replica set (master-and-standby) deployment, shard deployment, replica set, and Shard hybrid deployment.

How to deploy Hybrid


The process of writing data to MongoDB under a hybrid deployment approach


Read the data flow in MongoDB under Hybrid deployment mode


For replica sets, and for the primary and the two roles, the write data and read data are also different, the process of writing data is written only to the main node, by the main node asynchronously synchronized to the slave node:


The read data is only read from any node, and the specific node read can be specified:


For MongoDB Shards, suppose we take an index key (ID) as the chip key, the ID of the interval [0,50], divided into 5 chunk, respectively, stored in 3 slices server,:


If the volume of data is large, the need to increase the chip server can be as long as the mobile chunk to evenly divide the data.

To configure a node:

The server that stores the profile is actually the data model that stores the configuration node stored by the chip key and the chunk and the chunk and the server, using the above data.


Routing nodes:

The nodes of the routing role play a role of load balancing in the case of sharding.

To learn more about MongoDB, read the "MongoDB authoritative guide", "deep learning MongoDB", "MongoDB real Combat"

Diagram of MongoDB principle

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.