mongodb3.0.4 MongoDB-CR Authentication failed

邓鸿彩
2023-12-01

新的mongodb3.0.4环境添加用户后,应用服务器一直报错验证失败。

但是到相关库下验证,结果返回1
db.auth(“username”,”password”);
1
切换到admin库下,查看system.version
{ “_id” : “authSchema”, “currentVersion” : 5 }
查看system.users
“credentials” : { “SCRAM-SHA-1” : { “iterationCount” : 10000, “salt” : “kq2a1voVWIdWctIwD0IvtQ==”, “storedKey” : “s2lumlIjpHK7bvSicSM6jY5uxNw=”, “serverKey” : “J8CL/meaRaUy6yWg17E0NQoqqa0=” } }
看到验证信息内容不一样
以前版本的currentVersion是3
db.system.version.find();db.system.version.find();
{ “_id” : “authSchema”, “currentVersion” : 3 }
以前版本是这样的:
“credentials” : { “MONGODB-CR” : “c922154fe32022bfe7f02da6bc27cab8” }
那么根据以下步骤操作:

I’ve applied the change you suggested
1) Start 3.0 without auth enabled
2) Run (on admin db):

var schema = db.system.version.findOne({“_id” : “authSchema”})
schema.currentVersion = 3
db.system.version.save(schema)
3) restart with auth enabled.

Software with new drivers (only tested csharp driver) and legacy software works fine.

这里我是把原来的用户drop然后修改schema.currentVersion=3,不需要重启服务,最后重新建用户即可。
参考https://jira.mongodb.org/browse/SERVER-17459

 类似资料:

相关阅读

相关文章

相关问答