Mongodb 无法连接到 localhost 但可以连接到 localhost 的 IP 地址 [英] Mongodb can't connect to localhost but can connect to localhost's IP address
本文介绍了Mongodb 无法连接到 localhost 但可以连接到 localhost 的 IP 地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
If I try to run mongodb shell with the mongo
command alone, I get:
Error: couldn't connect to server 127.0.0.1 shell/mongo.js:84
exception: connect failed
However, if I stipulate localhost's LAN IP address like this:
mongo 10.10.5.90
...it connects fine.
Any clues??
解决方案
Do you have a bind_ip
set in your mongodb.conf (or startup script)? edit for clarity A bind_ip
setting limits the IP it will listen on to that IP only.
See the IP Address Binding section: http://www.mongodb.org/display/DOCS/Security+and+Authentication
If not, do you have any firewall rules blocking the localhost access? That would be kind of strange, but I can't think of another reason why it wouldn't work while the LAN IP would work.
这篇关于Mongodb 无法连接到 localhost 但可以连接到 localhost 的 IP 地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文