Introduction and construction of MONGODB cluster scheme
I. What is a MONGODB cluster?
Refers to a server cluster consisting of multiple MongoDB servers, called a MongoDB cluster.
Two. How the MongoDB cluster is built:
1.Replica Set replica set:
Simple is that the cluster contains a number of data, to ensure that the main node hangs, the standby node can continue to provide data services, provided the premise is that the data needs and the primary node consistent.
By default, the master node provides all the additions and deletions, and the standby node does not provide any services. However, you can provide a query service by setting up the standby node, which can reduce the pressure on the primary node, and when the client makes a data query, the request is automatically forwarded to the standby node. This setting is called Read Preference Modes.
The quorum node is a special node that does not store data by itself, and the main purpose is to decide which standby node is promoted to the primary node after the master node is hung, so the client does not need to connect to this node. Although there is only one standby node, a quorum node is still required to raise the node level. I do not believe that there must be a quorum node, but I have tried not to quorum node, the master node hangs the standby node or the standby node, so we still need it.
2. sharding Shard:
sharding and replica set are similar and require a quorum node, but sharding also needs to configure nodes and routing nodes. This is the most complex of the three ways to build a cluster.
Why Sharding will need to configure replica Set. In fact, it can be understood that the data of multiple nodes is definitely related, if not a replica Set, how to identify the same cluster? This is also the provisions of MongoDB, we still abide by it. Configure a CFG and initialize the configuration as previously stated.
3. Master-slaver Master and Slave:
This is the simplest answer to the cluster building, but the exact said can not be considered a cluster, can only be said to be the main preparation.basically as long as the main node and the standby node to execute the two commands, master-slaver even if the build is complete. I have not tried to see if the primary node can become the primary node, but since it has not been recommended, we do not need to use it.
Three. Build a MongoDB cluster:
Introduction and construction of DataBase MongoDB cluster scheme