Last active
August 29, 2015 14:07
-
-
Save dbmurphy/f2619088bd853f3f883e to your computer and use it in GitHub Desktop.
Move Chunk (assumes) 2.4+
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function MoveChunk(chunk,count){ | |
good_shards=["shard4","shard5","shard6","shard7"]; | |
printjson(chunk); | |
moveObject= { moveChunk : chunk.ns, find: chunk.min , to : good_shards[count % good_shards.length], __waitForDelete:false,__secondaryThrottle:true} | |
printjson(moveObject); | |
printjson("++++++++++++++++++++++"); | |
printjson(db.adminCommand(moveObject)); | |
printjson("++++++++++++++++++++++"); | |
} | |
count=0; | |
db.getSiblingDB('config').chunks.find({ns:"somedb.somecollection",shard:"shard3"}).skip(22).limit(25).forEach( | |
function(chunk)){ | |
print("->>>>>>>> Processing chunk "+count+"/25 <--------------"); | |
MoveChunk(chunk,count); | |
count+=1; | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment