停止排空 mongodb 中的碎片 [英] Stop draining shard in mongodb
问题描述
--- Sharding Status ---
sharding version: { "_id" : 1, "version" : 3 }
shards:
{ "_id" : "set1", "host" : "set1/m1.example.com:27018,mr1.example.com:27018,mrb1.example.com:27018" }
{ "_id" : "set2", "draining" : true, "host" : "set2/m2.example.com:27018,mr2.example.com:27018,mrb2.example.com:27018" }
{ "_id" : "set3", "host" : "set3/m3.example.com:27018,mr3.example.com:27018,mrb3.example.com:27018" }
我错误地从分片集群中删除了 set2,它开始排空,我该如何停止排空?
by mistake I remove set2 from the shard cluster, and it starts draining, how do i stop the draining ?
推荐答案
RemoveShard 将启动排空过程,但没有 StopRemoveShard 命令.没关系,目前还没有命令,因为手动停止进程很容易.
RemoveShard will start the draining process but there is no StopRemoveShard command. It is alright there isn't a command yet since it is easy to stop the process manually.
Draining 只是平衡器开始将块从标记的分片(正在排空)中移出的状态.您可以通过删除分片元数据配置上的特殊排水"字段来停止排水.
Draining is just a state where the balancer starts to move chunks off the marked shard (which is draining). You can stop draining by removing the special "draining" field on the shard metadata configuration.
//connect to a mongos server with the mongo javascript shell
use config
//unset draining from all shards
db.shards.update({},{$unset:{draining:true}}, false, true)
完成此操作后,平衡器将恢复正常平衡,不再消耗分片.
After this is done the balancer will go back to normal balancing, and no longer drain the shard.
这篇关于停止排空 mongodb 中的碎片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!