1.

Suppose we have a five-node replica set distributed across three data centres: dc1, dc2 and dc3. What would be configurations that meet the following requirements: 

Answer»

Any query on sharded cluster goes through mongos to config database where it looks for metadata information about the chunk distribution.

These queries are generally divided into broadly 2 groups:

Scatter gather queries:

Scatter-gather queries are the one which does not include the shard key. Since there are no shard keys, mongos does not know which shard to send this query to, HENCE it searches on all shards in the cluster. These queries are generally inefficient and are unfeasible for routine operations on large clusters.

Targeted queries:

If a query includes the shard key, the mongos DIRECTS the query to SPECIFIC shards only that are part of query as per shard key. These queries are very efficient.

Now, in this CASE, we have a query with a shard key search 15000<=EMPLOYEEID<=70000, which is a subset of the data from the entire cluster and so it’s a targeted query. Any shard with employee id within this range will be queries. From the above sample, we can see below shards fall within this range and will all be accessed by the query.

  • Shard0000
  • Shard0002
  • Shard0003
  • Shard0004
  • Shard0005
  • Shard0006
  • Shard0007


Discussion

No Comment Found