MongoDB/Ubuntu connect ECONNREFUSED 172.xxx.xxx.xx:27017

I have setup a Linode using the market place for MongoDB on a Ubunto. I have used # ufw and created a rule.

ufw allow 27017/tcp

ufw now shows the ports allow from Anywhere.

Without this open, the computer took awhile for the connection from MongoDB Compass to fail. But once added, the system comes back in 3 seconds with:

connect ECONNREFUSED 172.xxx.xxx.xx:27017

I got the IP address from the cloud.linode.com portal by click on my new Linode and looking at the machine. I can launch LISH and connect to the console, even run # mongo and look at the databases, etc.

So it appears that my machine is allowing the traffic. The security: section in the mongod.conf file whos security authentication turned off right now, even though I did add a admin user to the admin database.

Any additional steps I need to take or guidance on setting up my database for remote access accross the Internet using the TCP with the IP and Port 27017.

1 Reply

I figured it out. Not only did I have to open the port on the ufw. I also had to edit /etc/mongod.conf and append the ip address of my server to the binded server.

network interfaces

net:
port: 27017
bindIp: 127.0.0.1, 172.xxx.xxx.xx

Make sure you turn on authentication.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct