2019-10-10T18:00:35.308+0530 W NETWORK [ReplicaSetMonitor-TaskExecutor] Unable to reach primary for set Cluster0-shard-0

Hi , I am getting below mentioned error while connecting to :

connecting to: mongodb://cluster0-shard-00-00-jxeqq.mongodb.net:27017,cluster0-s
hard-00-01-jxeqq.mongodb.net:27017,cluster0-shard-00-02-jxeqq.mongodb.net:27017/
video?authSource=admin&compressors=disabled&gssapiServiceName=mongodb&replicaSet
=Cluster0-shard-0
2019-10-10T18:00:19.834+0530 I NETWORK [js] Starting new replica set monitor f
or 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-10-10T18:00:19.837+0530 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connec
ting to cluster0-shard-00-01-jxeqq.mongodb.net:27017
2019-10-10T18:00:19.840+0530 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connec
ting to cluster0-shard-00-02-jxeqq.mongodb.net:27017
2019-10-10T18:00:19.841+0530 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connec
ting to cluster0-shard-00-00-jxeqq.mongodb.net:27017
2019-10-10T18:00:23.925+0530 W NETWORK [ReplicaSetMonitor-TaskExecutor] DNS re
solution while connecting to cluster0-shard-00-01-jxeqq.mongodb.net:27017 took 4
086ms
2019-10-10T18:00:23.946+0530 W NETWORK [ReplicaSetMonitor-TaskExecutor] DNS re
solution while connecting to cluster0-shard-00-02-jxeqq.mongodb.net:27017 took 4
105ms
2019-10-10T18:00:23.972+0530 W NETWORK [ReplicaSetMonitor-TaskExecutor] DNS re
solution while connecting to cluster0-shard-00-00-jxeqq.mongodb.net:27017 took 4
129ms
2019-10-10T18:00:24.500+0530 W NETWORK [ReplicaSetMonitor-TaskExecutor] Unable
to reach primary for set Cluster0-shard-0
2019-10-10T18:00:24.503+0530 I NETWORK [ReplicaSetMonitor-TaskExecutor] 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-10-10T18:00:24.837+0530 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connec
ting to cluster0-shard-00-00-jxeqq.mongodb.net:27017
2019-10-10T18:00:24.842+0530 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connec
ting to cluster0-shard-00-01-jxeqq.mongodb.net:27017
2019-10-10T18:00:24.848+0530 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connec
ting to cluster0-shard-00-02-jxeqq.mongodb.net:27017
2019-10-10T18:00:25.308+0530 W NETWORK [ReplicaSetMonitor-TaskExecutor] Unable
to reach primary for set Cluster0-shard-0
2019-10-10T18:00:25.310+0530 I NETWORK [ReplicaSetMonitor-TaskExecutor] 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-10-10T18:00:25.789+0530 W NETWORK [ReplicaSetMonitor-TaskExecutor] Unable
to reach primary for set Cluster0-shard-0
2019-10-10T18:00:25.791+0530 I NETWORK [ReplicaSetMonitor-TaskExecutor] 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-10-10T18:00:26.307+0530 W NETWORK [ReplicaSetMonitor-TaskExecutor] Unable
to reach primary for set Cluster0-shard-0
2019-10-10T18:00:26.310+0530 I NETWORK [ReplicaSetMonitor-TaskExecutor] 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-10-10T18:00:26.337+0530 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connec
ting to cluster0-shard-00-02-jxeqq.mongodb.net:27017
2019-10-10T18:00:26.339+0530 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connec
ting to cluster0-shard-00-00-jxeqq.mongodb.net:27017
2019-10-10T18:00:26.341+0530 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connec
ting to cluster0-shard-00-01-jxeqq.mongodb.net:27017
2019-10-10T18:00:26.818+0530 W NETWORK [ReplicaSetMonitor-TaskExecutor] Unable
to reach primary for set Cluster0-shard-0
2019-10-10T18:00:26.820+0530 I NETWORK [ReplicaSetMonitor-TaskExecutor] 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-10-10T18:00:27.294+0530 W NETWORK [ReplicaSetMonitor-TaskExecutor] Unable
to reach primary for set Cluster0-shard-0
2019-10-10T18:00:27.296+0530 I NETWORK [ReplicaSetMonitor-TaskExecutor] 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-10-10T18:00:27.780+0530 W NETWORK [ReplicaSetMonitor-TaskExecutor] Unable
to reach primary for set Cluster0-shard-0
2019-10-10T18:00:27.782+0530 I NETWORK [ReplicaSetMonitor-TaskExecutor] 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-10-10T18:00:27.837+0530 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connec
ting to cluster0-shard-00-02-jxeqq.mongodb.net:27017
2019-10-10T18:00:27.838+0530 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connec
ting to cluster0-shard-00-01-jxeqq.mongodb.net:27017
2019-10-10T18:00:27.840+0530 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connec
ting to cluster0-shard-00-00-jxeqq.mongodb.net:27017
2019-10-10T18:00:28.295+0530 W NETWORK [ReplicaSetMonitor-TaskExecutor] Unable
to reach primary for set Cluster0-shard-0
2019-10-10T18:00:28.297+0530 I NETWORK [ReplicaSetMonitor-TaskExecutor] 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-10-10T18:00:29.302+0530 W NETWORK [ReplicaSetMonitor-TaskExecutor] Unable
to reach primary for set Cluster0-shard-0
2019-10-10T18:00:29.304+0530 I NETWORK [ReplicaSetMonitor-TaskExecutor] 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-10-10T18:00:29.342+0530 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connec
ting to cluster0-shard-00-02-jxeqq.mongodb.net:27017
2019-10-10T18:00:29.343+0530 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connec
ting to cluster0-shard-00-00-jxeqq.mongodb.net:27017
2019-10-10T18:00:29.344+0530 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connec
ting to cluster0-shard-00-01-jxeqq.mongodb.net:27017
2019-10-10T18:00:29.804+0530 W NETWORK [ReplicaSetMonitor-TaskExecutor] Unable
to reach primary for set Cluster0-shard-0
2019-10-10T18:00:29.806+0530 I NETWORK [ReplicaSetMonitor-TaskExecutor] 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-10-10T18:00:30.302+0530 W NETWORK [ReplicaSetMonitor-TaskExecutor] Unable
to reach primary for set Cluster0-shard-0
2019-10-10T18:00:30.303+0530 I NETWORK [ReplicaSetMonitor-TaskExecutor] 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-10-10T18:00:30.837+0530 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connec
ting to cluster0-shard-00-00-jxeqq.mongodb.net:27017
2019-10-10T18:00:30.839+0530 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connec
ting to cluster0-shard-00-02-jxeqq.mongodb.net:27017
2019-10-10T18:00:31.301+0530 W NETWORK [ReplicaSetMonitor-TaskExecutor] Unable
to reach primary for set Cluster0-shard-0
2019-10-10T18:00:31.344+0530 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connec
ting to cluster0-shard-00-01-jxeqq.mongodb.net:27017
2019-10-10T18:00:31.809+0530 W NETWORK [ReplicaSetMonitor-TaskExecutor] Unable
to reach primary for set Cluster0-shard-0
2019-10-10T18:00:32.284+0530 W NETWORK [ReplicaSetMonitor-TaskExecutor] Unable
to reach primary for set Cluster0-shard-0
2019-10-10T18:00:32.344+0530 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connec
ting to cluster0-shard-00-00-jxeqq.mongodb.net:27017
2019-10-10T18:00:32.346+0530 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connec
ting to cluster0-shard-00-02-jxeqq.mongodb.net:27017
2019-10-10T18:00:32.348+0530 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connec
ting to cluster0-shard-00-01-jxeqq.mongodb.net:27017
2019-10-10T18:00:32.797+0530 W NETWORK [ReplicaSetMonitor-TaskExecutor] Unable
to reach primary for set Cluster0-shard-0
2019-10-10T18:00:33.295+0530 W NETWORK [ReplicaSetMonitor-TaskExecutor] Unable
to reach primary for set Cluster0-shard-0
2019-10-10T18:00:33.794+0530 W NETWORK [ReplicaSetMonitor-TaskExecutor] Unable
to reach primary for set Cluster0-shard-0
2019-10-10T18:00:33.837+0530 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connec
ting to cluster0-shard-00-02-jxeqq.mongodb.net:27017
2019-10-10T18:00:33.838+0530 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connec
ting to cluster0-shard-00-00-jxeqq.mongodb.net:27017
2019-10-10T18:00:33.840+0530 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connec
ting to cluster0-shard-00-01-jxeqq.mongodb.net:27017
2019-10-10T18:00:34.286+0530 W NETWORK [ReplicaSetMonitor-TaskExecutor] Unable
to reach primary for set Cluster0-shard-0
2019-10-10T18:00:34.804+0530 W NETWORK [ReplicaSetMonitor-TaskExecutor] Unable
to reach primary for set Cluster0-shard-0
2019-10-10T18:00:35.308+0530 W NETWORK [ReplicaSetMonitor-TaskExecutor] Unable
to reach primary for set Cluster0-shard-0

*** It looks like this is a MongoDB Atlas cluster. Please ensure that your IP wh
itelist allows connections from your network.

2019-10-10T18:00:35.314+0530 E QUERY [js] Error: connect failed to replica s
et 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:341:17
@(connect):2:6
2019-10-10T18:00:35.325+0530 F - [main] exception: connect failed
2019-10-10T18:00:35.326+0530 E - [main] exiting with code 1

Looks like you’re experiencing the same issue as this poster:


See if the suggestion from one of the Curriculum Engineers helps.

Hi @Abhishek_09580,

It appears to me that you are trying to connect to the video database. Though you should not have any difficulty in doing that but I am afraid you might have introduced some junk characters while editing the connection string.

Can you please try to connect using the connection string mentioned below?

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

If the issue still persists please feel free to get back to us.

Thanks,
Shubham Ranjan
Curriculum Support Engineer