My question is on the answer given at Difference between Sharding And Replication on MongoDB
I need to split thedata of 75GB into 3 shards of 25GB each with replication factor of 3. Answer depicts below picture
Sharded Cluster
/ | \
Shard A Shard B Shard C
/ \ / \ / \
+-------+ +---------+ +-------+ +---------+ +-------+ +---------+
|Primary| |Secondary| |Primary| |Secondary| |Primary| |Secondary|
| 25GB |=| 25GB | | 25 GB |=| 25 GB | | 25GB |=| 25GB |
+-------+ +---------+ +-------+ +---------+ +-------+ +---------+
and says we need at least 6 database servers organized in three replica-sets. Each replica-set consists of two servers who have the same 25GB of data.
My understanding is that each shard is a physical machine holding below two sets of data(primary and secondary) and host two separate mongod server/instance . One will hold primary data and second will hold secondary data which is back up of primary data on another shard
Primary data :- This is 1/3 of the 75GB data distributed over some partition key
Secondary :- This will hold secondary data which is back up of primary data on another shard
Application query will go only to primary data on a given shard based on partition key. It is possible that on a shard a secondary gets converted to primary if another shard primary goes down . Is my understanding correct here ?
No of instances of Mongos and Arbiter
Also i believe i need to start only 1 mongos instance(which will be separate from mongod instance) ? Similarly I need to have single mongo arbiter for all 3 shards instead of 3 on each shard ? Both mongos and aribiter can be on separate machine or share the hardware of one of the shard depending on requirement ?