InterviewSolution
| 1. |
Which of the following queries will require that to load every document into RAM in order to fulfil the query? |
|
Answer» In sharded cluster we may have a database which has sharded as well as non sharded collections. While the sharded collections are spread across all the shards, all the unsharded collections are stored on a single shard known as a primary shard. Every database in the sharded collection has its own primary shard. When we create any new database, mongos pick the shard with the least amount of data in cluster and marks it as a primary shard. If there is a need to change the primary shard we can do so by using the movePrimary command. This migration may take significant time to complete. We should not access any collections associated with MIGRATING database until the process completes. Also, the migration of primary shard should be done at the LEAN time as it may impact the performance of the OVERALL cluster. Eg. To MIGRATE the primary shard of accounts database to Shard0007 below command should be used. db.adminCommand( { MOVEPRIMARY : "accounts", to : "shard0007" } ) |
|