简体   繁体   中英

Robomongo: Cannot connect to replica set. Set's primary is unreachable

I'm migrating mLab from Heroku to MongoDB Atlas. As one of steps I want to check if there is a connectivity to newly created cluster. I'm used Robo3T (formerly Robomongo) for Heroku mLab instances. But it doesn't work with Atlas. I'm getting following error when creating connection from URL:

Cannot connect to replica set "SampleProject"[cluster-abcd12ef-shard-00-00.a0b1c.mongodb.net:27017]. 
Set's primary is unreachable.

Reason:
Failed to initialize MongoWorker. Reason: connect failed

Tried to adjust settings, but everything looks correct there, like for Heroku, the only host and port are different.

Also looked on similar questions and on GitHub isssues but nothing helped.

I'm migrating mLab from Heroku to MongoDB Atlas. As one of steps I want to check if there is a connectivity to newly created cluster. I'm used Robo3T (formerly Robomongo) for Heroku mLab instances. But it doesn't work with Atlas. I'm getting following error when creating connection from URL:

Cannot connect to replica set "SampleProject"[cluster-abcd12ef-shard-00-00.a0b1c.mongodb.net:27017]. 
Set's primary is unreachable.

Reason:
Failed to initialize MongoWorker. Reason: connect failed

Tried to adjust settings, but everything looks correct there, like for Heroku, the only host and port are different.

Also looked on similar questions and on GitHub isssues but nothing helped.

If anyone getting this error while using Robo3T version 1.4.4 , we can resolve this issue by update robo3t.json file (enable logs and you can see where this file localed)

By enable Logs, you will see where settings saved via message starts with Info: Settings saved to: {robo3t.json_path}

  • Paste your URI as normal, then click From URI as normal, then Save.
  • Close Robo3T (important)
  • Open robo3t.json file using some text editor.
  • Inside connections scope, lookup your connection just created from step above, find allowInvalidCertificates property inside ssl object, change value from false to true then save the file
  • Open Robo3T then connect to the connection, it should connect normally

确保您已在Network Access下的 mongodb 云门户上将您的 IP 地址列入白名单

Check your username and password!

tl;dr

It seems Robo 3T 1.4.3 returns the Cannot connect to replica set... Set's primary is unreachable error also for authentication errors. Double check your user credentials.

Details

In the past, all the above excellent answers have helped me resolve this error message. However, recently I encountered an Atlas cluster that seemed immune to all workarounds. I finally gave up and tried with the "official" MongoDB Compass client that Atlas promotes. This client also returned an error, but a different and far more useful one:

bad auth: Authentication failed.

Suspecting an incorrect password, I generated a new password for the user in Atlas and updated it in Robo 3T. After this Robo successfully connected to the DB.

After doing import "From URI" i had to go TLS -> "Authentication Method" and select "Self-signed Certificate".

I didn't have the same problem when connecting from the MongoDB extension on VSCode.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM