This file contains hidden or 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
user='XXXX'; | |
pass='XXXX'; | |
indexPattern={ 'Key' : 1 }; | |
indexOptions={}; | |
db.getSiblingDB('config').shards.find({},{host:1,_id:0}).forEach(function(shard){ | |
tHosts = shard.host.split('/')[1].split(',') | |
tHosts.forEach(function(host){ | |
print("Freezing "+ host); | |
x= new Mongo(host); | |
x.getDB('admin').auth(user,pass); |
This file contains hidden or 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
CloudFilesUser="XXXX" | |
CloudFilesKey="XXXXXX" | |
mongoshost="XXXXXX" | |
mongosport=99999 | |
mongouser="XXXXXX" | |
mongopass="XXXXX" | |
#Path to you mongo binaries | |
mongobinpath=~/mongodb-linux-x86_64-2.4.6/bin | |
db=$(echo `date +"stats_%d%m%Y"`) |
This file contains hidden or 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
//Get last 10 actions | |
db.getSiblingDB('config').changelog.find().sort({time:-1}).limit(10) | |
//Get Last 10 attempted moves | |
db.getSiblingDB('config').changelog.find({what:/moveChunk.start/}).sort({time:-1}).limit(10) | |
//Get Last 10 completed moves | |
db.getSiblingDB('config').changelog.find({what:/moveChunk.commit/}).sort({time:-1}).limit(10) | |
//Get Chunk Actions by hour/day (What can be moveChunk.start, moveChunk.commit, moveChunk.from, split |
This file contains hidden or 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
//All Jumbo Chunks | |
db.foo.find({jumbo:true}); | |
//Order By documents | |
db.foo.find({jumbo:true}).sort({docs:-1}); | |
//Order By size | |
db.foo.find({jumbo:true}).sort({size:-1}); | |
//Aggregate looking for jumbos by shard ( Set size and docs lower from 64/250k due to test size) |
This file contains hidden or 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("++++++++++++++++++++++"); | |
} | |
This file contains hidden or 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
mongos> chunksPerShard_Aggregation | |
{ "$group" : { "_id" : "$shard", "count" : { "$sum" : 1 } } } | |
mongos> chunksPerShardByNS_Aggregation | |
{ | |
"$group" : { | |
"_id" : { | |
"shard" : "$shard", | |
"ns" : "$ns" | |
}, | |
"count" : { |