Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Does Replica Set in Shard Cluster only stores a "Sharded Copy" or "All Sharded" Copies?

I understand the idea of Replica Set and am able to pull Replica Set Setup by using 3 server, the logic is as below, the reference are from this link https://severalnines.com/database-blog/turning-mongodb-replica-set-sharded-cluster :

enter image description here

So I came to have confusion when I am trying to understand how does Sharded Cluster works in Replica Logic, the reference I was able to find is as below:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

enter image description here

There are a few concerns:

  1. Does Shard 1’s Primary only hold 33% of datas?
  2. Does Shard 1’s Secondary (Replica) hold the data from Shard 2’s Primary and Shard 3’s Primary?
  3. I can see "mongos" knows the Shard 1, Shard 2 and Shard 3 location, then what is the use of mongod config?
  4. Is the logic of server placement as below?:

enter image description here

>Solution :

  1. Does Shard 1’s Primary only hold 33% of datas?

Yes, it does – provided your database and collection have "sharding enabled".

  1. Does Shard 1’s Secondary (Replica) hold the data from Shard 2’s Primary and Shard 3’s Primary?

No, they don’t. Shard 1’s Secondaries hold a copy of Shard 1’s Primary data.

  1. I can see "mongos" knows the Shard 1, Shard 2 and Shard 3 location, then what is the use of mongod config?

The config replica set stores all kind of meta data, e.g. user accounts and privileges and – very important – it stores which ranges of data are stored in which shard. Otherwise, when you insert or read any data, you would not know to which shard they belong to.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading