【发布时间】:2014-09-14 00:13:58
【问题描述】:
我有一个运行 Ubuntu 12.04 LTS 和 MongoDB 实例的 Linode 服务器(服务正在运行并且可以在本地连接),但我无法从外部源连接。
我已将这两个规则添加到我的 IP 表中,其中
iptables -A INPUT -s < ip-address > -p tcp --destination-port 27017 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -d < ip-address > -p tcp --source-port 27017 -m state --state ESTABLISHED -j ACCEPT
我在我的 IP 表中看到规则允许在 27017 上与
mongo databasedomain/databasename -u username -p password
我收到此错误:
2014-07-22T23:54:03.093+0000 warning: Failed to connect to databaseserverip:27017, reason: errno:111 Connection refused
2014-07-22T23:54:03.094+0000 Error: couldn't connect to server < ip address >:27017 (databaseserverip), connection attempt failed at src/mongo/shell/mongo.js:148
exception: connect failed
非常感谢任何帮助!!!!谢谢!!!
【问题讨论】:
-
你确定其他 mongod 正在运行吗?可以本地连接吗?
-
mongod 在本地运行,是的,我可以在本地连接。
标签: linux mongodb firewall iptables