Failed to connect to Atlas using Mongo Shell

The Error message is below. I have tried to reinstall the mongodb but the problem is still there.

C:\Users\XXX
mongo “mongodb://cluster0-shard-00-00-jxeqq.mongodb.net:27017,cluster0-shard-00-01-jxeqq.mongodb.net:27017,cluster0-shard-00-02-jxeqq.mongodb.net:27017/test?replicaSet=Cluster0-shard-0” --authenticationDatabase admin --ssl --username m001-student --password m001-mongodb-basics
MongoDB shell version v4.0.6
connecting to: mongodb://cluster0-shard-00-00-jxeqq.mongodb.net:27017,cluster0-shard-00-01-jxeqq.mongodb.net:27017,cluster0-shard-00-02-jxeqq.mongodb.net:27017/test?authSource=admin&gssapiServiceName=mongodb&replicaSet=Cluster0-shard-0
2019-02-26T23:10:47.865-0500 I NETWORK [js] Starting new replica set monitor for Cluster0-shard-0/cluster0-shard-00-00-jxeqq.mongodb.net:27017,cluster0-shard-00-01-jxeqq.mongodb.net:27017,cluster0-shard-00-02-jxeqq.mongodb.net:27017
2019-02-26T23:10:48.031-0500 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0
2019-02-26T23:10:48.032-0500 I NETWORK [js] Cannot reach any nodes for set Cluster0-shard-0. Please check network connectivity and the status of the set. This has happened for 1 checks in a row.
2019-02-26T23:10:48.741-0500 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0
2019-02-26T23:10:48.741-0500 I NETWORK [js] Cannot reach any nodes for set Cluster0-shard-0. Please check network connectivity and the status of the set. This has happened for 2 checks in a row.
2019-02-26T23:10:49.425-0500 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0
2019-02-26T23:10:49.425-0500 I NETWORK [js] Cannot reach any nodes for set Cluster0-shard-0. Please check network connectivity and the status of the set. This has happened for 3 checks in a row.
2019-02-26T23:10:50.115-0500 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0
2019-02-26T23:10:50.115-0500 I NETWORK [js] Cannot reach any nodes for set Cluster0-shard-0. Please check network connectivity and the status of the set. This has happened for 4 checks in a row.
2019-02-26T23:10:50.798-0500 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0
2019-02-26T23:10:50.798-0500 I NETWORK [js] Cannot reach any nodes for set Cluster0-shard-0. Please check network connectivity and the status of the set. This has happened for 5 checks in a row.
2019-02-26T23:10:51.481-0500 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0
2019-02-26T23:10:51.482-0500 I NETWORK [js] Cannot reach any nodes for set Cluster0-shard-0. Please check network connectivity and the status of the set. This has happened for 6 checks in a row.
2019-02-26T23:10:52.173-0500 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0
2019-02-26T23:10:52.174-0500 I NETWORK [js] Cannot reach any nodes for set Cluster0-shard-0. Please check network connectivity and the status of the set. This has happened for 7 checks in a row.
2019-02-26T23:10:52.866-0500 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0
2019-02-26T23:10:52.866-0500 I NETWORK [js] Cannot reach any nodes for set Cluster0-shard-0. Please check network connectivity and the status of the set. This has happened for 8 checks in a row.
2019-02-26T23:10:53.548-0500 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0
2019-02-26T23:10:53.548-0500 I NETWORK [js] Cannot reach any nodes for set Cluster0-shard-0. Please check network connectivity and the status of the set. This has happened for 9 checks in a row.
2019-02-26T23:10:54.239-0500 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0
2019-02-26T23:10:54.239-0500 I NETWORK [js] Cannot reach any nodes for set Cluster0-shard-0. Please check network connectivity and the status of the set. This has happened for 10 checks in a row.
2019-02-26T23:10:54.937-0500 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0
2019-02-26T23:10:54.938-0500 I NETWORK [js] Cannot reach any nodes for set Cluster0-shard-0. Please check network connectivity and the status of the set. This has happened for 11 checks in a row.
2019-02-26T23:10:55.621-0500 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0
2019-02-26T23:10:56.311-0500 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0
2019-02-26T23:10:56.991-0500 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0
2019-02-26T23:10:57.688-0500 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0
2019-02-26T23:10:58.370-0500 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0
2019-02-26T23:10:59.063-0500 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0
2019-02-26T23:10:59.749-0500 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0
2019-02-26T23:11:00.427-0500 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0
2019-02-26T23:11:01.109-0500 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0
2019-02-26T23:11:01.800-0500 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0
2019-02-26T23:11:01.801-0500 I NETWORK [js] Cannot reach any nodes for set Cluster0-shard-0. Please check network connectivity and the status of the set. This has happened for 21 checks in a row.
2019-02-26T23:11:02.499-0500 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0
2019-02-26T23:11:02.500-0500 E QUERY [js] Error: connect failed to replica set Cluster0-shard-0/cluster0-shard-00-00-jxeqq.mongodb.net:27017,cluster0-shard-00-01-jxeqq.mongodb.net:27017,cluster0-shard-00-02-jxeqq.mongodb.net:27017 :
connect@src/mongo/shell/mongo.js:343:13
@(connect):1:6
exception: connect failed

I am able to connect with your command
From where you are trying to connect?office or home?
May be firewall preventing the connection
Are you able to ping the server
vagrant@m103:~/data/db$ ping cluster0-shard-00-00-jxeqq.mongodb.net
PING ec2-34-195-121-130.compute-1.amazonaws.com (34.195.121.130) 56(84) bytes of data.
64 bytes from ec2-34-195-121-130.compute-1.amazonaws.com (34.195.121.130): icmp_seq=1 ttl=35 time=286 ms
^C
ec2-34-195-121-130.compute-1.amazonaws.com ping statistics —
2 packets transmitted, 1 received, 50% packet loss, time 1002ms
rtt min/avg/max/mdev = 286.263/286.263/286.263/0.000 ms

vagrant@m103:~/data/db$ mongo mongodb://cluster0-shard-00-00-jxeqq.mongodb.net:27017,cluster0-shard-00-01-jxeqq.mongodb.net:27017,cluster0-shard-00-02-jxeqq.mongodb.net:27017/test?replicaSet=Cluster0-shard-0 --authenticationDatabase admin --ssl --username m001-student --password m001-mongodb-basics
MongoDB shell version v3.6.9
connecting to: mongodb://cluster0-shard-00-00-jxeqq.mongodb.net:27017,cluster0-shard-00-01-jxeqq.mongodb.net:27017,cluster0-shard-00-02-jxeqq.mongodb.net:27017/test?replicaSet=Cluster0-shard-0
2019-02-27T04:18:51.428+0000 I NETWORK [thread1] Starting new replica set monitor for Cluster0-shard-0/cluster0-shard-00-00-jxeqq.mongodb.net:27017,cluster0-shard-00-01-jxeqq.mongodb.net:27017,cluster0-shard-00-02-jxeqq.mongodb.net:27017

MongoDB Enterprise Cluster0-shard-0:PRIMARY> db
test
MongoDB Enterprise Cluster0-shard-0:PRIMARY> use admin
switched to db admin
MongoDB Enterprise Cluster0-shard-0:PRIMARY> show dbs
100YWeatherSmall 0.128GB
admin 0.000GB

Hi Ramachandra,
Thanks for the reply. I am connecting from my apartment and able to ping the server.

1 Like
  1. Have you set some other username and password while configuring the MongoDB users on the cluster. If yes use that user name and password.

  2. Have you whitelisted your IP? If not first whitelist it.

Hi Chase_23389,

Sorry for your experience.

Can you try installing 3.6 MongoDB version and try connecting from that?

I have seen students having trouble but not enough to confirm if it is an issue. Let me know if it works.

Kanika

1 Like

Hi Kanikasingla,

Thanks for the help! It worked after I installed version 3.6!

Hi Kanika,
I have installed version 4.0.6 and I give the following command. The 3 dot keeps blinking without connecting. You have advised other to install 3.6 version - can’t we find solution to this error?
mongo “mongodb://cluster0-shard-00-00-jxeqq.mongodb.net:27017,cluster0-shard-00-01-jxeqq.mongodb.net:27017,cluster0-shard-00-02-jxeqq.mongodb.net:27017/test?replicaSet=Cluster0-shard-0” --authenticationDatabase admin --ssl --username m001-student --password m001-mongodb-basics


Many thanks
Ajay
P.S,- Kanika if we do not get urgent response we will not be able to complete the workshop on time . Request urgent help Regards Ajay

You are already connected to mongo.Your snapshot shows you are at mongo prompt and trying to issue the command again
exit and run your command from os prompt(windows or vagrant)

1 Like

[Ramachandra_37567] Thanks for your response.
When I start a new CMD prompt and issue the following command
mongo “mongodb://cluster0-shard-00-00-jxeqq.mongodb.net:27017,cluster0-shard-00-01-jxeqq.mongodb.net:27017,cluster0-shard-00-02-jxeqq.mongodb.net:27017/test?replicaSet=Cluster0-shard-0” --authenticationDatabase admin --ssl --username m001-student --password m001-mongodb-basics
I get the following error message
MongoDB shell version v4.0.6
exception: No digits

I am able to connect from my vagrant.No issues

vagrant@m103:/dataset$ mongo mongodb://cluster0-shard-00-00-jxeqq.mongodb.net:27017,cluster0-shard-00-01-jxeqq.mongodb.net:27017,cluster0-shard-00-02-jxeqq.mongodb.net:27017/test?replicaSet=Cluster0-shard-0 --authenticationDatabase admin --ssl --username m001-student --password m001-mongodb-basics
MongoDB shell version v3.6.9
connecting to: mongodb://cluster0-shard-00-00-jxeqq.mongodb.net:27017,cluster0-shard-00-01-jxeqq.mongodb.net:27017,cluster0-shard-00-02-jxeqq.mongodb.net:27017/test?replicaSet=Cluster0-shard-0

MongoDB Enterprise Cluster0-shard-0:PRIMARY> db
test
MongoDB Enterprise Cluster0-shard-0:PRIMARY> use admin
switched to db admin
MongoDB Enterprise Cluster0-shard-0:PRIMARY> show dbs
100YWeatherSmall 0.128GB
admin 0.000GB

Thanks a lot Ramchandra_37567. After multiple tries the same command got working. For those who are getting error on Windows 8 64bit, the command given in tutorial works for me now. Here is a print of successful command to connec to MongoDB

Agree. Finally, it worked for me by uninstalling ver. 4 dan changed to ver 3.6