我已经设置了两个服务器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
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
Error: 2 SASL authentication support not compiled into client library.
at src/mongo/shell/db.js:228
exception: login failed
Run Code Online (Sandbox Code Playgroud)
如果我使用:
mongo DB --host HOST --port PORT -u USER -p PASSWORD
--authenticationDatabase DB
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
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
Run Code Online (Sandbox Code Playgroud)
如果我使用:
mongo DB --host HOST --port PORT
Run Code Online (Sandbox Code Playgroud)
我进去但后来我需要使用db.auth来做任何事情然后我得到这个错误:
Error: 18 { …Run Code Online (Sandbox Code Playgroud) mongodb ×1