mongodb Robo 3T 错误:网络无法访问
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/45450712/
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
Robo 3T Error : Network is unreachable
提问by Hisham Mubarak
I am trying to connect Robo 3T to my online database and it doesn't seem to be working. I am able to connect to local database with it. I tried connecting using MongoDB Compass and the Details and Auth are working fine and I am able to connect. But when I connect with the same details in Robo 3T, it doesn't seem to be working. How do I fix this? I am using Robo 3T Version 1.1 I tried same with Robomongo 1.0, and still getting the same error
我正在尝试将 Robo 3T 连接到我的在线数据库,但它似乎无法正常工作。我可以用它连接到本地数据库。我尝试使用 MongoDB Compass 进行连接,Details 和 Auth 工作正常,我能够连接。但是当我在 Robo 3T 中连接相同的细节时,它似乎不起作用。我该如何解决?我使用的是 Robo 3T 1.1 版,我在 Robomongo 1.0 上尝试过,但仍然出现相同的错误
采纳答案by Z. Alvin
Just change your bind_ip in /etc/mongod.conf from 127.0.0.1 to 0.0.0.0 then restart the service, and it works for me~
只需将/etc/mongod.conf中的bind_ip从127.0.0.1更改为0.0.0.0然后重新启动服务,它对我有用~
回答by Jose Guillen
A better solution is to comment out or remove the bindIpsetting from the config file /etc/mongod.conf
更好的解决方案是从配置文件/etc/mongod.conf 中注释掉或删除bindIp设置
You must restart the service for the change to take effect
您必须重新启动服务才能使更改生效
回答by PeterS
If you get the following error then you should also check the following:
如果您收到以下错误,那么您还应该检查以下内容:
The atlas servers at least require this setting, if you do not choose it, then you generally get the Network is unreachable message.
atlas 服务器至少需要这个设置,如果你不选择它,那么你通常会收到 Network is unreachable 消息。
Also if you are using Atlas then you should check the Authentication tab and select SCRAM-SHA-1, however this generally results in an authentication error not a network unreachable one.
此外,如果您使用的是 Atlas,那么您应该检查身份验证选项卡并选择 SCRAM-SHA-1,但这通常会导致身份验证错误,而不是网络无法访问的错误。
回答by Xin Lv
I also meet this problem when I use Robo 3T on Mac. I think there are some things you need to check to help you know what's the problem.
我在Mac上使用Robo 3T时也遇到这个问题。我认为您需要检查一些事项以帮助您了解问题所在。
First try to ping
the mongo server in your terminal to see whether you can get responses. If so, that's means you may set wrong mongo config in you Robo 3T.
首先尝试ping
终端中的mongo服务器,看看是否可以得到响应。如果是这样,这意味着您可能在 Robo 3T 中设置了错误的 mongo 配置。
If you cannot get the response, that means there is something wrong with your network. You should check your DNS and your network gateway. For example my DNS is 172.16.*
and my network gateway (execute ifconig
and check en0
) is 172.17.*
. And they are not belong to the same network segment. (Actually, even if they are on the same network segment, things won't work if someone polluted your DNS server.)
如果您无法获得响应,则表示您的网络存在问题。您应该检查您的 DNS 和网关。例如我的 DNS 是172.16.*
,我的网关(执行ifconig
和检查en0
)是172.17.*
. 并且它们不属于同一网段。(实际上,即使它们在同一网段,如果有人污染了您的DNS服务器,则无法正常工作。)
That's the problem. The DNS that you are using cannot interpret your mongo host correctly. Someone may had polluted this DNS server.
这就是问题所在。您使用的 DNS 无法正确解释您的 mongo 主机。可能有人污染了这个 DNS 服务器。
You can have a try on ping xxx(your mongo-server) @8.8.8.8
, which will use 8.8.8.8 as your DNS. If everything goes well, then you get the sollution.
您可以试试ping xxx(your mongo-server) @8.8.8.8
,它将使用 8.8.8.8 作为您的 DNS。如果一切顺利,那么你就得到了解决方案。
Sollution: Manually set DNS for your devices. For example, Google's public DNS, 8.8.8.8 and 8.8.4.4.
解决方案:为您的设备手动设置 DNS。例如,Google 的公共 DNS,8.8.8.8 和 8.8.4.4。
Actually, if you run dig xxx(your mongo-server)
before and after you manually set DNS, you may find the response Ip differently.
实际上,如果您dig xxx(your mongo-server)
在手动设置 DNS 之前和之后运行,您可能会发现响应 Ip 不同。
回答by pohl
I had this symptom, and the ultimate fix is not yet captured in an answer here.
我有这个症状,最终的解决方法尚未在此处的答案中捕获。
I was trying to connect to a mongo instance in the cloud using Robo 3T, and I was getting the "Network is unreachable" message.
我试图使用 Robo 3T 连接到云中的 mongo 实例,但收到“网络无法访问”消息。
Oddly, I could connect from using Robo 3T inside a Parallels VM on the same machine.
奇怪的是,我可以在同一台机器上的 Parallels VM 中使用 Robo 3T 进行连接。
This led me to try the full Studio 3T on my mac, which could also connect just fine.
这让我在我的 Mac 上尝试了完整的 Studio 3T,它也可以正常连接。
Ultimately, I discovered that there was an old dotfile from an ancient version of Robomongo that was causing the problem. rm -rf .config/robomongo
did the trick. Now I can connect with the ordinary, free Robo 3T.
最终,我发现有一个来自旧版 Robomongo 的旧点文件导致了这个问题。 rm -rf .config/robomongo
成功了。现在我可以连接普通的、免费的 Robo 3T。
I'm guessing that I had an expired trial of Robomongo, from back before it was free, perhaps?
我猜我的 Robomongo 试用期已经过期,也许是在它免费之前?
回答by mahmoud
sorry if i'm late to this but i was running through the same issue all morning. You have to go through a few things first so you can troubleshoot easily
对不起,如果我迟到了,但我整个上午都在处理同样的问题。您必须先完成几件事,才能轻松排除故障
- Restart the database from the terminal, hitting the database at the correct path and let it run in the background.
- if the database is running then go through checking the local host address, and replace it with 127.0.0.1 instead of the generic localhost:27017
- 从终端重启数据库,在正确的路径点击数据库,让它在后台运行。
- 如果数据库正在运行,则检查本地主机地址,并将其替换为 127.0.0.1 而不是通用的localhost:27017
回答by Cris Topher
This might help, my robo mongo server is hosted in cloud. I have setup the mongodb but could not connect to it using Robo3T. Keeps telling network timedout (this means network problem). Been reading a lot to figure out the cause, suddenly I remembered I have also a security group in my cloud network. Just include the mongod port 27017 in the list of allowed incoming. That's it!
这可能会有所帮助,我的 robo mongo 服务器托管在云中。我已经设置了 mongodb,但无法使用 Robo3T 连接到它。一直告诉网络超时(这意味着网络问题)。一直在阅读大量内容以找出原因,突然我想起我的云网络中还有一个安全组。只需在允许传入的列表中包含 mongod 端口 27017。就是这样!
回答by Vikash Kumar
Go Inside bin folder of MongoDB and run mongod
command:- C:\Program Files\MongoDB\Server\4.2\bin
then open command prompt at this location and run mongod
command & then try to connect with Robo 3T . It works for me.
进入 MongoDB 的 bin 文件夹并运行mongod
命令:-C:\Program Files\MongoDB\Server\4.2\bin
然后在此位置打开命令提示符并运行mongod
命令,然后尝试与 Robo 3T 连接。这个对我有用。
Also create data folder inside your C:
drive & then create a db named folder inside data folder. that's it.
还要在C:
驱动器内创建数据文件夹,然后在数据文件夹内创建一个名为文件夹的数据库。就是这样。
回答by Jonathan
As said above, this is probably due to BindIp, if you use mac and brew to install it you won't find anything in /etc/mongod.conf instead you find it in /usr/local/etc/mongod.conf
如上所述,这可能是由于 BindIp,如果您使用 mac 和 brew 安装它,您将不会在 /etc/mongod.conf 中找到任何内容,而是在/usr/local/etc/mongod.conf 中找到它
systemLog:
destination: file
path: /usr/local/var/log/mongodb/mongo.log
logAppend: true
storage:
dbPath: /usr/local/var/mongodb
net:
bindIp: 127.0.0.1
Change BindIp with caution!
谨慎更改 BindIp!
And same goes for running it, to start MongoDB manualy use:
运行它也是如此,手动启动MongoDB:
mongod --config /usr/local/etc/mongod.conf
mongod --config /usr/local/etc/mongod.conf
or configure autostart on login with launchd by typing:
或通过键入以下内容使用 launchd 配置登录时自动启动:
brew services start mongodb
brew services start mongodb
I've also encountered corrupted data files on my local computer here:
我还在这里遇到了本地计算机上损坏的数据文件:
/usr/local/var/mongodb
just removed them and it worked, you could see in the log that errors like:
刚刚删除它们并且它起作用了,您可以在日志中看到如下错误:
** IMPORTANT: UPGRADE PROBLEM: The data files need to be fully upgraded to version 3.6 before attempting an upgrade to 4.0; see http://dochub.mongodb.org/core/4.0-upgrade-fcv for more details.
2018-08-01T00:15:50.220+0200 I NETWORK [initandlisten] shutdown: going to close listening sockets...
2018-08-01T00:15:50.220+0200 I NETWORK [initandlisten] removing socket file: /tmp/mongodb-27017.sock
2018-08-01T00:15:50.224+0200 I STORAGE [initandlisten] WiredTigerKVEngine shutting down
2018-08-01T00:15:50.303+0200 I STORAGE [initandlisten] Downgrading WiredTiger datafiles.
2018-08-01T00:15:50.501+0200 I STORAGE [initandlisten] WiredTiger message [1533075350:501686][3594:0x7fffb492e380], txn-recover: Main recovery loop: starting at 14/3712
2018-08-01T00:15:50.598+0200 I STORAGE [initandlisten] WiredTiger message [1533075350:598867][3594:0x7fffb492e380], txn-recover: Recovering log 14 through 15
2018-08-01T00:15:50.664+0200 I STORAGE [initandlisten] WiredTiger message [1533075350:663976][3594:0x7fffb492e380], txn-recover: Recovering log 15 through 15
2018-08-01T00:15:50.715+0200 I STORAGE [initandlisten] WiredTiger message [1533075350:715398][3594:0x7fffb492e380], txn-recover: Set global recovery timestamp: 0
2018-08-01T00:15:51.002+0200 I STORAGE [initandlisten] shutdown: removing fs lock...
2018-08-01T00:15:51.005+0200 I CONTROL [initandlisten] now exiting
2018-08-01T00:15:51.005+0200 I CONTROL [initandlisten] shutting down with code:62
** IMPORTANT: UPGRADE PROBLEM: The data files need to be fully upgraded to version 3.6 before attempting an upgrade to 4.0; see http://dochub.mongodb.org/core/4.0-upgrade-fcv for more details.
2018-08-01T00:15:50.220+0200 I NETWORK [initandlisten] shutdown: going to close listening sockets...
2018-08-01T00:15:50.220+0200 I NETWORK [initandlisten] removing socket file: /tmp/mongodb-27017.sock
2018-08-01T00:15:50.224+0200 I STORAGE [initandlisten] WiredTigerKVEngine shutting down
2018-08-01T00:15:50.303+0200 I STORAGE [initandlisten] Downgrading WiredTiger datafiles.
2018-08-01T00:15:50.501+0200 I STORAGE [initandlisten] WiredTiger message [1533075350:501686][3594:0x7fffb492e380], txn-recover: Main recovery loop: starting at 14/3712
2018-08-01T00:15:50.598+0200 I STORAGE [initandlisten] WiredTiger message [1533075350:598867][3594:0x7fffb492e380], txn-recover: Recovering log 14 through 15
2018-08-01T00:15:50.664+0200 I STORAGE [initandlisten] WiredTiger message [1533075350:663976][3594:0x7fffb492e380], txn-recover: Recovering log 15 through 15
2018-08-01T00:15:50.715+0200 I STORAGE [initandlisten] WiredTiger message [1533075350:715398][3594:0x7fffb492e380], txn-recover: Set global recovery timestamp: 0
2018-08-01T00:15:51.002+0200 I STORAGE [initandlisten] shutdown: removing fs lock...
2018-08-01T00:15:51.005+0200 I CONTROL [initandlisten] now exiting
2018-08-01T00:15:51.005+0200 I CONTROL [initandlisten] shutting down with code:62
回答by Sai Krishnan
Start the MongoDB service from the task manager. Worked for me.
从任务管理器启动 MongoDB 服务。对我来说有效。
In my case both mongod and mongo.exe was throwing a 100 error code.
就我而言,mongod 和 mongo.exe 都抛出了 100 错误代码。