I have a Linode server running Ubuntu 12.04 LTS and an instance of MongoDB (the service is running and CAN connect locally), with which I cannot connect from an external source.
I added these two rules to my IP tables, where <ip address> is the server on which I want to connect FROM (as indicated in this MongoDB link ):
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
And I see a rule in my IP table that allows connections to 27017 in and out of <ip address> however, when I try to connect, <ip address> to my mongo database using the following command:
mongo databasedomain/databasename -u username -p password
I get this error:
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
Any help is VERY RATED !!!! Thank!!!
linux mongodb firewall iptables
dbcooper Jul 23 '14 at 0:12 2014-07-23 00:12
source share