0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

sh.moveChunk

This commit is contained in:
Eliot Horowitz 2011-05-13 17:02:07 -04:00
parent 08b057a79d
commit c57cf8d1ae
2 changed files with 15 additions and 1 deletions

View File

@ -1585,8 +1585,10 @@ const StringData _jscode_raw_utils_sh =
"print( \"\\tsh.addShard( host ) server:port OR setname/server:port\" )\n"
"print( \"\\tsh.enableSharding(dbname) enables sharding on the database dbname\" )\n"
"print( \"\\tsh.shardCollection(fullName,key,unique) shards the collection\" );\n"
"\n"
"print( \"\\tsh.splitFind(fullName,find) splits the chunk that find is in at the median\" );\n"
"print( \"\\tsh.splitAt(fullName,middle) splits the chunk that middle is in at middle\" );\n"
"print( \"\\tsh.moveChunk(fullName,find,to) move the chunk where 'find' is to 'to' (name of shard)\");\n"
"\n"
"print( \"\\tsh.setBalancerState( <bool on or not> ) turns the balancer on or off true=on, false=off\" );\n"
"print( \"\\tsh.getBalancerState() return true if on, off if not\" );\n"
@ -1631,6 +1633,11 @@ const StringData _jscode_raw_utils_sh =
"sh._adminCommand( { split : fullName , middle : middle } )\n"
"}\n"
"\n"
"sh.moveChunk = function( fullName , find , to ) {\n"
"sh._checkFullName( fullName );\n"
"sh._adminCommand( { moveChunk : fullName , find : find , to : to } )\n"
"}\n"
"\n"
"sh.setBalancerState = function( onOrNot ) {\n"
"db.getSisterDB( \"config\" ).settings.update({ _id: \"balancer\" }, { $set : { stopped: onOrNot ? false : true } }, true );\n"
"}\n"

View File

@ -27,9 +27,11 @@ sh.help = function() {
print( "\tsh.addShard( host ) server:port OR setname/server:port" )
print( "\tsh.enableSharding(dbname) enables sharding on the database dbname" )
print( "\tsh.shardCollection(fullName,key,unique) shards the collection" );
print( "\tsh.splitFind(fullName,find) splits the chunk that find is in at the median" );
print( "\tsh.splitAt(fullName,middle) splits the chunk that middle is in at middle" );
print( "\tsh.moveChunk(fullName,find,to) move the chunk where 'find' is to 'to' (name of shard)");
print( "\tsh.setBalancerState( <bool on or not> ) turns the balancer on or off true=on, false=off" );
print( "\tsh.getBalancerState() return true if on, off if not" );
@ -73,6 +75,11 @@ sh.splitAt = function( fullName , middle ) {
sh._adminCommand( { split : fullName , middle : middle } )
}
sh.moveChunk = function( fullName , find , to ) {
sh._checkFullName( fullName );
sh._adminCommand( { moveChunk : fullName , find : find , to : to } )
}
sh.setBalancerState = function( onOrNot ) {
db.getSisterDB( "config" ).settings.update({ _id: "balancer" }, { $set : { stopped: onOrNot ? false : true } }, true );
}