1.

Explain different architectural components of MongoDB.

Answer»

The MongoDB balancer is a background process that monitors the number of chunks on each shard. When the number of chunks on a given shard reaches specific migration thresholds, the balancer attempts to automatically migrate chunks between SHARDS and reach an equal number of chunks per shard.

All chunk MIGRATIONS use the following procedure:

  1. The moveChunk command is sent to the source shard by the balancer.
  2. First internal chunks at the source shard move due to moveChunk command. All operations are routed to the source shard during the migration process. All writes for the chunks are taken by source shard at this point.
  3. All required indexes are built at the destination shard.
  4. Once index built is completed destination shard starts requesting documents in a chunk from source shard and starts receiving them.
  5. Once the final document chunk is received, destination shard does synchronization so that all changes occurred during the migration are ALSO migrated.
  6. Once synchronization is complete cluster metadata is updated with the new location of the chunk in config DATABASE by source shard.
  7. Finally, source shard verifies that cluster metadata is updated correctly with new chunk location and once verified source shard deletes its copy of the migrated document.


Discussion

No Comment Found