For scaling / fault tolerance, mongodb uses a "replica set" where there is a primary and one or more secondary servers. Primary is used for recording. Secondary are used for reading. This is pretty much the primary slave pattern used in SQL programming. If the primary decreases, the secondary in the secondary cluster takes its place. Thus, the issue of horizontal scaling and fault tolerance will be taken care of. However, this is not a solution that makes you stunned. A true fragment contains only a fraction of all the data, so if the secondary in the replica set is a fragment, how can it qualify as primary when it does not have all the data needed to service requests?
Shouldn't we have a replica set for each of the fragments?
This is obviously a beginner, so a link that visually or otherwise illustrates how to do this will be useful.
source share