MongoDB cluster technology includes two parts: replica set and sharding. There is also a master-slave mode, which mongoDB does not currently recommend in favor of replica sets. \

Duplicate sets replicate data and save multiple copies. The same copy is stored on different servers and automatically switches over when a fault occurs. Corresponding to data redundancy, backup, mirroring, read/write separation, high availability and other keywords;

\

Sharding means to process a large amount of data and store the data separately. Different servers store different data, and the sum of their data is the whole data set. The pursuit is high performance.

\

In a production environment, it is usually a combination of these two techniques, shard + replica set.

\

See my book for details:

MongoDB cluster — copy \

\

MongoDB cluster — Sharding

\