当前位置:网站首页>Illustration of mongodb cluster deployment principle (3)

Illustration of mongodb cluster deployment principle (3)

2022-06-23 17:51:00 Tom bomb architecture

MongoDB There are three types of roles in the cluster deployment scenario of : The actual data storage node 、 Configuration file storage node and routing access node .

The connected client is directly connected to the routing node , Query data from the configuration node , Query and store data on the actual storage node according to the query results .MongoDB There are single machine deployment 、 Copy Collection ( The main equipment ) Deploy 、 Split deployment 、 Hybrid deployment of replica set and fragmentation .

The mixed deployment is shown in the figure :

file

In the mixed deployment mode, it is necessary to MongoDB The process of writing data is shown in the figure :

file

Read in mixed deployment mode MongoDB The data flow in is shown in the figure below :

file

For replica sets , There are two roles, master and slave , Writing data is different from reading data , The process of writing data is to write only to the master node , From master node to slave node asynchronously :

file

While reading data only needs to read from any node , Specific to which node to read can be specified :

file

about MongoDB The fragmentation of , Let's say we use an index key (ID) For the chip key ,ID The range of 0,50, Divide into 5 individual chunk, Store separately to 3 In a slice server , As shown in the figure :

file

If there's a lot of data , When you need to add a slice server, you can just move chunk To divide the data evenly .

Configuration node :

The server that stores configuration files actually stores chip keys and chunk as well as chunk And server The mapping relation of , The data model of configuration node storage represented by the above data is shown in the following table :

Map1

Key range

chunk

[0,10)

chunk1

[10,20)

chunk2

[20,30)

chunk3

[30,40)

chunk4

[40,50)

chunk5

Map2

chunk

shard

chunk1

shard1

chunk2

shard1

chunk3

shard2

chunk4

shard2

chunk5

shard3

Routing nodes :

Nodes with routing role play the role of load balancing in the case of fragmentation .

Pay attention to WeChat public number 『 Tom Bomb architecture 』 reply “MongoDB” Supporting materials are available .

This paper is about “Tom Bomb architecture ” original , Reprint please indicate the source . Technology is about sharing , I share my happiness ! If you have any suggestions, you can also leave comments or private letters , Your support is the driving force for me to adhere to my creation . Pay attention to WeChat public number 『 Tom Bomb architecture 』 More technical dry goods are available !

Originality is not easy. , Persistence is cool , You can see it here , Little buddy, remember to praise 、 Collection 、 Looking at , One click three times plus attention ! If you think the content is too dry , You can share and forward it to friends !

原网站

版权声明
本文为[Tom bomb architecture]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/01/202201051557506795.html