1

There is some issue coming while connect mongo shell to the atlas cluster. It is saying that No primary detected for set Cluster0-shard-0.

ashish@ashish-Not-Specified:~$ mongo "mongodb://cluster0-shard-00-00-pth8i.mongodb.net:27017,cluster0-shard-00-01-pth8i.mongodb.net:27017,cluster0-shard-00-02-pth8i.mongodb.net:27017/test?replicaSet=Cluster0-shard-0" --authenticationDatabase admin --ssl --username m001-student --password m001-mongodb-basics
    MongoDB shell version: 3.2.17
    connecting to: mongodb://cluster0-shard-00-00-pth8i.mongodb.net:27017,cluster0-shard-00-01-pth8i.mongodb.net:27017,cluster0-shard-00-02-pth8i.mongodb.net:27017/test?replicaSet=Cluster0-shard-0
    2017-10-25T22:12:00.759+0530 I NETWORK  [thread1] Starting new replica set monitor for Cluster0-shard-0/cluster0-shard-00-00-pth8i.mongodb.net:27017,cluster0-shard-00-01-pth8i.mongodb.net:27017,cluster0-shard-00-02-pth8i.mongodb.net:27017
    2017-10-25T22:12:00.759+0530 I NETWORK  [ReplicaSetMonitorWatcher] starting
    2017-10-25T22:12:09.080+0530 W NETWORK  [thread1] No primary detected for set Cluster0-shard-0
    2017-10-25T22:12:18.389+0530 I NETWORK  [ReplicaSetMonitorWatcher] Socket recv() timeout  34.204.152.215:27017
    2017-10-25T22:12:18.610+0530 W NETWORK  [thread1] No primary detected for set Cluster0-shard-0
    2017-10-25T22:12:18.610+0530 E QUERY    [thread1] Error: connect failed to replica set Cluster0-shard-0/cluster0-shard-00-00-pth8i.mongodb.net:27017,cluster0-shard-00-01-pth8i.mongodb.net:27017,cluster0-shard-00-02-pth8i.mongodb.net:27017 :
    connect@src/mongo/shell/mongo.js:223:14
    @(connect):1:6

    exception: connect failed
2

@ashishkumar148, I would like to say that as per MongoDB BOL Here , MongoDB Atlas cluster only able to connect with MongoDB 3.4 version, due to Mongo Shell with TLS/SSL support.

I have gone through you mongo shell log , where i have found out that as you are using MongoDB shell version: 3.2.17.

I am also attaching the Sandbox MongoDB Cluster connect screen shot to you.

enter image description here

Note:- Before making the connection with MongoDB Atlas with MongoDB shell, make sure that you have successfully configured your IP address through Mongo Atlas IP whitelist Here .And the IP status is Active. And during the connection the User ID & Password should be used, which you have Assigned in MongoDB Atlas cluster creation time.

0

It could not connect to the cluster nodes... Probably firewall was blocking access to port 27017, if the cluster was running.

  • Firewall is not blocking the 'port 27017'. Because the OP is able to run mongo shell. – Md Haidar Ali Khan Oct 26 '17 at 7:49
0

I currently have this challenge until I discovered that the problem was the difference between the mongo server version and the shell. I tried to connect the same mongo server with a mongo shell of the same version and it worked.

  • 1
    I'm not sure that this answers the question asked? Maybe if you want to flag it yourself as a comment - might be an idea? I know that you have to have a certain rep for comments. – Vérace Dec 9 '17 at 13:35

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.