我已经设置了两台服务器s1和s2。 s1是运行Web服务器的服务器,而s2是运行我的mongodb的服务器。为了安全性,我在mongo实例上设置了身份验证。当我尝试从s1连接到s2上的mongo实例时,在尝试进行身份验证时出现错误。Mongo身份验证
如果我使用:
mongo DB --host HOST --port PORT -u USER -p PASSWORD
--authenticationDatabase DB --authenticationMechanism SCRAM-SHA-1
我得到这个错误:
Error: 2 SASL authentication support not compiled into client library.
at src/mongo/shell/db.js:228
exception: login failed
如果我使用:
mongo DB --host HOST --port PORT -u USER -p PASSWORD
--authenticationDatabase DB
我得到这个错误:
Error: 18 { ok: 0.0, errmsg: "Challenge-response authentication using
getnonce and authenticate commands is disabled.", code: 2 } at
src/mongo/shell/db.js:228
exception: login failed
如果我使用:
mongo DB --host HOST --port PORT
我得到了,但那时我需要为了做任何事情来使用db.auth,然后我得到这个错误:
Error: 18 { ok: 0.0, errmsg: "Challenge-response authentication using
getnonce and authenticate commands is disabled.", code: 2 }
我不知道为什么我无法进入。有人可以帮助吗?
你正在使用哪个mongo服务器版本? 3.0.X我假设?然后,默认情况下,SCRAM-SHA-1处于活动状态,您的客户端也需要支持。 –