4

From last few days, I am facing connectivity issues with MongoDB Replica Sets deployed in google cloud. Interesting fact is these issues are appeared at Development machines and not on the production. Most common issues are:

  • Cannot connect to replica set "xxx"[xxx:27017]. Set's primary is unreachable.
  • A primary with different host name [:27017] found in server side. Different members found under same replica set name "XXX"

These error are appeared frequently. How to resolve this?

Here is the screenshot of the error appeared: Error connecting MongoDB

  • Check the GCP Firewall rules. – Bhuvanesh Jul 12 '18 at 9:26
  • Thanks, I have already checked it, My IP is white listed there. – Kapil Bhagchandani Jul 12 '18 at 10:24
  • @KapilBhagchandani, What is MongoDB version(x,y,z)? – Md Haidar Ali Khan Jul 13 '18 at 21:39
  • @KapilBhagchandani, What is your O.S environment? – Md Haidar Ali Khan Jul 13 '18 at 22:33
  • I am using Mongo version 3.6.5. – Kapil Bhagchandani Jul 16 '18 at 6:16
2

As per Robomongo Tool error shows like that

A primary with different host name [:27017] found in server side. Please double check if same host name and ports are used as in server's replica set configuration. If same set name is used for different replica sets, this configuration is supported only on different instances of Robomongo. Please open a new Robomongo instance for each replica set which has the same set name.

As per github blog documentation here it seems like the problem is Robomongo cannot learn the set name which is a critical information for connections to replica sets.

For Example Workaround

  1. Find a way to get your replica set name, something like rs-..., it shows it in the URL
  2. Close Robomongo
  3. Open this file in your editor
    1. ~/.config/robomongo/1.0/robomongo.json on macOS
    2. C:\Users[your name].config\robomongo.json on Windows
    3. ~/.3T/robo-3t/1.2.1/robo3t.json on Linux
  4. Search for the empty setName and add the replica set name there and save the file
  5. Start Robomongo again and it should work

For further your ref here

| improve this answer | |
  • 2
    Provided solution worked for me, and it can be used as workaround to overcome this issue. I was able to detect an empty value of cachedSetName key and just copied the value same as of the value from setNameUserEntered key. But it is just a temporary solution. As soon as RoboMongo successfully connects it updates cachedSetName back to empty value. Thanks for your help. – Kapil Bhagchandani Jul 16 '18 at 7:06
  • @KapilBhagchandani,The "Robomongo" now officially name change to "robo3t". – Md Haidar Ali Khan Jul 16 '18 at 7:13
  • It does not matter how it changed its name. This work-around is still relevant! Thanks, you saved me! – Yan Khonski Sep 6 '19 at 15:40

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.