0
votes

I am trying to connect to mongodb from my system to different system but i am getting following error-

MongoDB shell version v3.4.5 connecting to: mongodb://192.168.0.152:27017/ 2017-06-23T18:06:50.643+0530 W NETWORK [thread1] Failed to connect to 192.168.0.108:27017 after 5000ms milliseconds, giving up. 2017-06-23T18:06:50.644+0530 E QUERY [thread1]

Error: couldn't connect to server 192.168.0.152:27017, connection attempt failed : connect@src/mongo/shell/mongo.js:237:13 @(connect):1:6 exception: connect failed

I tried various solutions listed on stackoverflow but didn't find any solution yet. Can somebody please help me out?

1

1 Answers

0
votes

getaddrinfo() resolves domain names through the DNS protocol (which is not related the Netbios Naming System - reason why writing a Windows PC Name is usually a bad idea). Depending of the underlying implementation of the function it might or might not be able to resolve Netbios Names.

Usually using a Netbios computer name is a bad idea, you should rely on a proper DNS architecture.

If you have the exact same error with a mongodb:// URL using solely an IP address, it's weird... Please provide more details on the IP address try case.

Also ensure that the server is not firewalled. Try a netcat connection using netcat for windows:

nc IP 27017 -vv

should say 'Connected'

Netcat for Windows: https://eternallybored.org/misc/netcat/