我已经搭建了两台服务器s1和s2。s1上运行着一个web服务器,而s2上则是我的mongodb数据库运行的地方。为了安全起见,我对mongo实例进行了身份验证。但是当我尝试从s1连接到s2上的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 }
我不知道为什么我进不去。有人能帮忙吗?