您的位置:首页 > 数据库 > Mongodb

mongodb 分片集群 删除片键 code : 20 sharding already enabled for collection

2017-08-30 21:14 946 查看
mongodb分片集群指定片键删除了一个collection,再次为这个collection创建片键的时候,会报错

{
"ok" : 0,
"errmsg" : "sharding already enabled for collection test.test",
"code" : 20
}


解决办法就是在config库里面删除这个collection相关的信息,主要涉及到的collection表有locks。

解决办法如下:

use config
db.collections.remove( { _id: "test.test" } )
db.chunks.remove( { ns: "test.test" } )
db.locks.remove( { _id: "test.test" } )
use admin
db.adminCommand("flushRouterConfig)


这个问题真的很坑。。。。。。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: