1

Any idea why I am not able to connect to the mongo database? I just installed it on a new debian following this https://linuxize.com/post/how-to-install-mongodb-on-debian-9/.

Mongo startup logs: https://hastebin.com/iyelaxasec.md

I issued mongo and get:

baseUser@vmd54274:~$ mongo
MongoDB shell version v4.0.19
connecting to: mongodb://127.0.0.1:27017/?gssapiServiceName=mongodb
2020-06-17T01:53:05.338+0200 E QUERY    [js] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection timed out :
connect@src/mongo/shell/mongo.js:344:17
@(connect):2:6
exception: connect failed

I didnt change any setting so everything should be running on the correct port. And I checked that the port is used by the service.

This is from lsof:

mongod     8898   mongodb   11u  IPv4 2530915      0t0  TCP 127.0.0.1:27017 (LISTEN)
  • Add the output of cat /var/log/mongodb/mongod.log to your question. – Nasir Riley Jun 17 at 0:47
  • @NasirRiley I already did. Thats the hastebin link – Gerolmed Jun 17 at 10:59
  • Add them while you are trying to connect. Do not post images of text. Use the codeblocks to put them into your question. – Nasir Riley Jun 17 at 11:02
0

I managed to find the issue myself. Appearently there was a flaw in my firewall configuration preventing access from localhost to mongodb

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.