mongodb 无法加载数据库列表

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/40047622/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 20:50:09  来源:igfitidea点击:

Failed to load list of databases

mongodbrobo3t

提问by ehsan shirzadi

I want to connect to a remote database using Robomongo. I can connect to to database but an error says that:
Failed to load list of databases
enter image description here

我想使用 Robomongo 连接到远程数据库。我可以连接到数据库,但错误提示:
无法加载数据库列表
在此处输入图片说明

What should I do?

我该怎么办?

回答by storagemode11

It took me 7 days to figure it out. When I have upgraded to Robo 3T version 1.3. it started working just fine. My previous version was 1.2.

我花了 7 天的时间才弄明白。当我升级到Robo 3T 1.3 版时。它开始工作得很好。我以前的版本是1.2

Good to know if you are having this issue.

很高兴知道您是否遇到此问题。

回答by srk

Go to Connection Settings -> Authentication - Provide Database name, username, password - Now test the connection I ran into the same issue, then I provided the above info which solved my issue

转到连接设置 -> 身份验证 - 提供数据库名称、用户名、密码 - 现在测试连接我遇到了同样的问题,然后我提供了解决我的问题的上述信息

Refer: (Vaibhav's post) Point 3.Populate DB name and username and password How to connect Robomongo to MongoDB

参考:(Vaibhav 的帖子)Point 3.Populate DB name and username and password How to connect Robomongo to MongoDB

回答by Gokhan Simsek

In my experience, it is related to failed database user/password authentication. So probably your IP connection to server is successful but you failed to connect to db. I suggest to double check your database username/password and try again.

根据我的经验,它与失败的数据库用户/密码身份验证有关。所以可能您的 IP 连接到服务器是成功的,但您无法连接到 db。我建议仔细检查您的数据库用户名/密码,然后重试。

And better to show what is inside "Show error details".

更好地显示“显示错误详细信息”中的内容。

回答by Jooeun Lee

This is because whatever user you are connecting as does not have the privileges to list the databases.

这是因为您连接的任何用户都没有列出数据库的权限。

https://docs.mongodb.com/manual/reference/built-in-roles/

https://docs.mongodb.com/manual/reference/built-in-roles/

Note that a user/role can connect and interact with a specific database/collection, but in order for Robomongo to list out the databases/collections, you need to let it connect to your database using a user that has listDatabasesprivileges.

请注意,用户/角色可以连接特定的数据库/集合并与之交互,但为了让 Robomongo 列出数据库/集合,您需要使用具有listDatabases权限的用户让它连接到您的数据库。

回答by Zhenya

I had the same error ("failed to load a list of databases"). Due to some reason all my databases and collections got removed. Apparently, Robomongo couldn't handle the situation when there are no databases/collections available on the server.

我有同样的错误(“无法加载数据库列表”)。由于某种原因,我所有的数据库和集合都被删除了。显然,当服务器上没有可用的数据库/集合时,Robomongo 无法处理这种情况。

To solve the issue, I connected to Mongo Shell, created a database, and created a collection there:

为了解决这个问题,我连接到 Mongo Shell,创建了一个数据库,并在那里创建了一个集合:

mongo (start mongo shell)
use local (create database named local)
db.createCollection("somename")

After that, I could connect to the Mongo server

之后,我可以连接到 Mongo 服务器

Update: I've faced this issue again, and this time it has been caused by the fact that it was a new Mongo installation on a virtual machine, and connections from other hosts weren't allowed, so I had to modify bindIP from 127.0.0.1 to 0.0.0.0 in /etc/mongod.conf

更新:我又遇到了这个问题,这次是因为它是在虚拟机上新安装的Mongo,不允许来自其他主机的连接,所以我不得不从127.0修改bindIP /etc/mongod.conf 中的 .0.1 到 0.0.0.0

net:
   bindIp: 0.0.0.0
   port: 27017

and restart mongo sudo service mongod restart

并重新启动mongo sudo service mongod restart

回答by Evelyn

Got the same issue when using mongodb version v4.2.0, but the auth settings don't help. Keep getting the following logs when connecting from Robo 3T(i.e.mongoRobo).

使用 mongodb 版本 v4.2.0 时遇到同样的问题,但身份验证设置无济于事。从 Robo 3T(iemongoRobo) 连接时,不断获取以下日志。

2019-09-30T16:41:52.286-0400 I  NETWORK  [listener] connection accepted from 127.0.0.1:53862 #1 (1 connection now open)
2019-09-30T16:41:52.286-0400 I  NETWORK  [conn1] received client metadata from 127.0.0.1:53862 conn1: { application: { name: "robo3t" }, driver: { name: "MongoDB Internal Client", version: "3.4.3-10-g865d2fb" }, os: { type: "Darwin", name: "Mac OS X", architecture: "x86_64", version: "17.7.0" } }
2019-09-30T16:41:52.292-0400 E  -        [conn1] Assertion: Location34348: cannot translate opcode 2010 src/mongo/rpc/message.h 120
2019-09-30T16:41:52.292-0400 I  NETWORK  [conn1] DBException handling request, closing client connection: Location34348: cannot translate opcode 2010
2019-09-30T16:41:52.292-0400 I  NETWORK  [conn1] end connection 127.0.0.1:53862 (0 connections now open)

Finally resolved it by upgrading Robo 3T to v1.3(mac)

最后通过将 Robo 3T 升级到 v1.3(mac) 解决了这个问题

回答by Mohammad Adam

I just found out that I have to upgrade to the latest version that supports latest version of MongoDB. It worked without any authentication.

我刚刚发现我必须升级到支持最新版本 MongoDB 的最新版本。它在没有任何身份验证的情况下工作。

回答by Keshav Lodhi

I have faced the same problem after updating the MongoDB version from 3.6 to 4.2and previously I was using the Robo 3T version 1.2. So I just updated the Robo 3Tversion from 1.2 to 1.3and it's started working again.

将 MongoDB 版本从3.6更新到 4.2后,我遇到了同样的问题,之前我使用的是Robo 3T version 1.2. 所以我刚刚将Robo 3T版本从1.2更新到 1.3,它又开始工作了。

回答by Vadakkumpadath

If you are using mongod --auth --dbpath /data/db1command to start MongoDB, remove --authand start it.

如果您使用mongod --auth --dbpath /data/db1命令启动 MongoDB,请删除--auth并启动它。

mongod --dbpath /data/db1

mongod --dbpath /data/db1

Now Robomongo will be able to connect without authentication. But starting without authentication is not safe. So take another terminal and create a user for your db using mongocommand as described in this article.

现在 Robomongo 将无需身份验证即可连接。但是在没有身份验证的情况下启动是不安全的。因此,使用另一个终端并使用本文中mongo所述的命令为您的数据库创建一个用户。

use myDB
db.createUser(
  {
    user: "myUserAdmin",
    pwd: "abc123",
    roles: [ { role: "dbAdminAnyDatabase", db: "admin" } ]
  }
)

Now restart your MongoDB with --auth. Connect with Robomongo after configuring above authentication details in its connection settings.

现在用--auth. 在其连接设置中配置上述身份验证详细信息后,与 Robomongo 连接。

mongod --auth --dbpath /data/db1

mongod --auth --dbpath /data/db1

回答by Pablo Ezequiel

I had the same problem (using Robomongo), then, I created an user with his password to connect to the database, and now It is working ok

我遇到了同样的问题(使用 Robomongo),然后,我用他的密码创建了一个用户来连接到数据库,现在它工作正常