【发布时间】:2013-06-25 03:30:33
【问题描述】:
我无法通过外部 API 或本地 mongo 客户端连接到我的 mongo 数据库,但可以从远程主机毫无问题地连接。
- 我已经启动
mongod,可以通过访问127.0.0.1:27017确认服务器正在运行 - 我已经关注this answer 没有运气
-
我尝试为 mongo 创建一个全新的数据库目录以生成一组新的数据库文件,但仍然没有成功 - 所以这不是锁定文件或权限问题。
$ mongo --verbose MongoDB shell version: 2.4.4 Mon Jun 24 20:11:08.764 versionArrayTest passed connecting to: test Mon Jun 24 20:11:08.847 creating new connection to:127.0.0.1:27017 Mon Jun 24 20:11:08.847 BackgroundJob starting: ConnectBG Mon Jun 24 20:12:11.848 JavaScript execution failed: Error: couldn't connect to server 127.0.0.1:27017 at src/mongo/shell/mongo.js:L112 Mon Jun 24 20:12:11.848 User Assertion: 12513:connect failed exception: connect failed
我正在运行 Ubuntu 12.04,我已经从 10gen 存储库安装了 mongo。原本一切正常,但重启服务器后,mongo 无法连接。
我的 netstat 返回:
$ netstat -nap
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:27017 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:10000 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:28017 0.0.0.0:* LISTEN -
【问题讨论】:
-
当您使用 mongo shell 显式连接到 127.0.0.1:27017 时会发生什么?
-
相同的结果 - 它只是超时。我尝试使用:
mongo、mongo 127.0.0.1:27017、mongo localhost:27017,以及尝试从自身连接到服务器的外部 IP 地址。
标签: mongodb ubuntu ubuntu-12.04