Exception: connect failed

I am unable to connect to Cluster database remotely via CMD.

I am using windows 10 pro, I had Mongo Shell v4.6 and could’nt connect I upgraded Mongo Shell to v4.9 and still can’t connect, getting the same error. I switched to several different internet connections.

I can Telnet and Ping the cluster Hostname but unable to connect via Shell.

tried several suggestions posted here but still no luck.

kindly assist.

Replied you on other thread
Please attach screen shot of the command used/error

here is the screenshot of the error.

I think you are trying to connect to sandbox cluster
Is it up?
Are you able to connect by compass
There are instructions on how to get the command line

Hi @Mukhtar_67650,

Please share the Connection String that you are using to connect to the cluster.

Thanks,
Sonali

@Sonali_Mamgain thanks for your time here is the here my connection string

mongo “mongodb+srv://cluster0-ha6bm.mongodb.net/test” --username m001-student --password Abc-123

Hi @Mukhtar_67650,

Please try to remove the inverted commas ("") from your connection string and also recheck your username and password.

If it still doesn’t does not work please ping the cluster hostname and send the screenshot.

Thanks,
Sonali

Hi @Sonali_Mamgain
here is my connection string the qoutes are ok.

I can ping the hostname also Telneting is ok, and compass connection is ok but the problem is only the shell.

mongo "mongodb+srv://cluster0-ha6bm.mongodb.net/test" --username m001-student --password Asdf1234

i changed the password to new one for checking.

Hi Mukhtar,

I had the same problem using the connection string, so I built up the string myself using the 3 nodes in my cluster.

e.g.
mongo “mongodb://sandbox-shard-00-00-ytmos.mongodb.net:27017,sandbox-shard-00-01-ytmos.mongodb.net:27017,sandbox-shard-00-02-ytmos.mongodb.net:27017/test?replicaSet=Sandbox-shard-0” --authenticationDatabase admin --ssl --username m001-student --password m001-mongodb-basics

Give that a try, using your own nodes.

Andrew

1 Like

Hi @Mukhtar_67650,

I am able to connect to your cluster using the same connection string. Please see the attached screenshot:

Please check for the following issues:

  • Your firewall is not blocking the connection to the host. Please share the screenshot of the output when you ping the hostname.

  • Make sure that you are not connecting to the cluster in the office network

Thanks,
Sonali

1 Like

@Andrew_10040 thanks for support, I have tried your suggestion and still no luck. I think there is network problem, maybe the my ISP is blocking the connection. thanks I will try to look for other ISP connection.

Thanks Sonali, I think the problem is internet connection issue as you said. maybe the ISP is blocking this connection request. I will try other internet tomorow. thanks alot.