我已经设置了两个服务器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 }
我不知道为什么我无法进入。有人可以帮忙吗?
答案 0 :(得分:1)
问题是与mongo客户端的错误版本有关。 使用命令
检查版本mongo --version
上登录mogodb时遇到了问题
以下解决了我的问题,我在Ubuntu xenial
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list
sudo apt-get update
sudo apt-get install mongodb-org
答案 1 :(得分:0)
您是否尝试过指定端口和数据库,然后是主机? 尝试:mongo host:port / bbdd -u XXX -p
您是否启用了TLS / SSL?
此致
答案 2 :(得分:0)
出现此错误:
Error: 2 SASL authentication support not compiled into client library.
哪个也适合其他错误,我认为您的客户端库不兼容。比较版本,如果需要升级。