InterviewSolution
| 1. |
Your replica set maintains five copies of the data.Either dc1-01, dc1-02 or dc2-01, dc2-02 may become primary.dc3-01 should never be primary.Clients may read from dc3-01. |
|
Answer» If MongoDB cannot split a chunk that exceeds the specified chunk size or contains a number of documents that exceeds the max, MongoDB labels the chunk as JUMBO. If the chunk size no longer hits the limits, MongoDB clears the jumbo flag for the chunk when the mongos reloads or rewrites the chunk metadata. But in some we need to follow the below process to clear the jumbo flag manually:
If the chunk is divisible, MongoDB removes the flag upon successful split of the chunk. Process
Below output from sh.status(true) shows that chunk with shard key range { "x" : 2 } -->> { "x" : 4 } is jumbo. --- Sharding Status --- .................. .................. test.foo shard key: { "x" : 1 } chunks: shard-b 2 shard-a 2 { "x" : { "$minKey" : 1 } } -->> { "x" : 1 } on : shard-b Timestamp(2, 0) { "x" : 1 } -->> { "x" : 2 } on : shard-a Timestamp(3, 1) { "x" : 2 } -->> { "x" : 4 } on : shard-a Timestamp(2, 2) jumbo { "x" : 4 } -->> { "x" : { "$maxKey" : 1 } } on : shard-b Timestamp(3, 0)
MongoDB removes the jumbo flag upon successful split of the chunk.
In some instances, MongoDB cannot split the no-longer jumbo chunk, such as a chunk with a range of single shard key value, and the preferred method to clear the flag is not applicable. Process
In the chunks collection of the config database, unset the jumbo flag for the chunk. For example, db.getSiblingDB("config").chunks.update( { ns: "test.foo", min: { x: 2 }, jumbo: true }, { $unset: { jumbo: "" } } )
After the jumbo flag has been cleared out from the chunks collection, update the cluster routing metadata cache. db.adminCommand( { flushRouterConfig: "test.foo" } ) |
|