Mongodb two ways to cluster
Copy set
is usually a master one from, a master more from
MongoDB requires a minimum of two nodes for replication. One is the master node, which handles client requests, and the rest is the slave node, responsible for replicating the data on the master node.
MongoDB each node common collocation method is: A master one from, a master many from.
The master node records all operations on it, oplog the primary node periodically from the node, and then performs these operations on its own copy of the data, ensuring that the data from the node is consistent with the primary node.
Replica set Features:
- N-node clusters
- Any node can be used as the master node
- All write operations are on the primary node
- Auto Fail-Over
- Automatic recovery
Sharding
In MongoDB there is another cluster, that is, the Shard technology, can meet the requirements of a large number of MONGODB data volume growth.
When MongoDB stores massive amounts of data, a machine may not be enough to store data, or it may not be sufficient to provide acceptable read and write throughput. At this point, we can divide the data on multiple machines so that the database system can store and process more data.
Why use Shards
- Copy all write operations to the master node
- Deferred sensitive data is queried on the master node
- A single replica set is limited to 12 nodes
- When the volume of requests is large, there is insufficient memory.
- Insufficient Local Disk
- Vertical expansion is expensive
"2016-11-1" "persist in Learning" "DAY16" "MongoDB" "Replica set Shard"