【发布时间】:2014-05-18 12:26:56
【问题描述】:
我设置了带有身份验证的副本集。我使用了this 教程。我设置了密钥文件、管理员用户和其他用户。一切正常 - 匿名访问被禁用,我可以登录
$ mongo
MongoDB shell version: 2.6.1
connecting to: test
Error while trying to show server startup warnings: not authorized on admin to execute command { getLog: "startupWarnings" }
rs0:PRIMARY> use admin
switched to db admin
rs0:PRIMARY> db.auth("USERNAME","PASSWORD")
1
rs0:PRIMARY>
使用我创建的用户的凭据。
但我无法从命令行登录
$ mongo -u 'USERNAME' -p 'PASSWORD'
MongoDB shell version: 2.6.1
connecting to: test
2014-05-18T14:23:47.324+0200 Error: 18 { ok: 0.0, errmsg: "auth failed", code: 18 } at src/mongo/shell/db.js:1210
exception: login failed
使用相同的凭据。我在文档或 SO 上没有找到任何有用的东西。
【问题讨论】:
标签: mongodb authentication database-replication