> db.runCommand( { movechunk : "mydata.news", find:{_id:"00001-00001-00000000000000000003"}, to:"shard0"})

这条命令将find的结果涉及的小块统统搬移到shard0,利用split和movechunk两条指令可以对分区做灵活的调整,不过split这条命令目前还没有在官方文档中列出来,MongoDB的作者们还需要更卖力啊。

语法:db.runCommand( { moveChunk : "test.blog.posts" , find : { author : "eliot" } , to : "shard1" } )

参数说明:

     moveChunk: a full collection namespace, including the database name 
     find: a query expression that falls within the chunk to be moved; the command will find the FROM (donor)  shard automatically 
     to: shard id where the chunk will be moved 

> db.runCommand( { split : "mydata.news" , middle : {_id:"00001-00001-00000000000001400000"}})

这条命令将手动生成一个小块,以指定的middle值为界