samedi 31 janvier 2015

How to get all documents from a particular chunks in MongoDB?


From mongos log, I got the following message



balancer move failed: { chunkTooBig: true, estimatedChunkSize: 408839903, ok: 0.0, errmsg: "chunk too big to move" } from: shard4 to: shard1


I know this issue occurs due to either



  1. documents size to large,

  2. index key not granular enough, and/or

  3. chunkSize too small


While I'm confident that case 2 and 3 are not the cause, I want to see whether someone abuses the database by inserting extra large documents.


The mongos log shows the docs are in the range :



min: { Country:"US", City:"LA" } max: { Country:"US": City:"NY" }


I want to aggregate the schema of documents within this range, and see if some documents contain extra fields.


Since the indexes are not monotonically increasing, I can't get all documents within this range (or can i?).


How can I



  1. get the chunkID with the query

    db.coll.find({ Country:"US", City:"LA" })




  2. get all the docs within this chunk?


Other suggestions are welcome. Thanks in advance



Aucun commentaire:

Enregistrer un commentaire