mongodb - 蒙戈认证

我已经设置了两台服务器 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 }

我不知道为什么我进不去。有人可以帮忙吗?

最佳答案

问题与 mongo 客户端版本错误有关。 使用命令检查版本

mongo --version

我在 https://mlab.com/ 上登录 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

https://stackoverflow.com/questions/31212219/

相关文章:

node.js - MongoError : attempt to write outside bu

mongodb - 通过 Grails 域标准在事件光标中发现 Mongo CursorNotFou

mongodb - jenssegers/laravel-mongodb 中的 MongoCurso

mongodb - MongoDB中的有向无环图设计模式

node.js - 2服务器负载均衡 Node js应用设置中的Elasticsearch部署

python - Mongo 连接从未发布 - Django 和 Mongoengine 使用 ge

javascript - 使用 Javascript/Node.js 在代码中执行 mongoimp

php - 如何安装 PHP 的 MongoDB 驱动程序 — "pecl install mong

node.js - 如何使用一个属性的值作为另一个属性的默认值?

mongodb - Mongorestore:ns 名称太长,最大大小为 128