Cannot connect to Mongodb Server without adding into Host Files

Hello @Ravindra_Pandey ,

To get better understanding of your use-case, could you please share below mentioned details?

  • MongoDB Version
  • How did you configure the replica set?

  • How are you trying to connect to the host? are you using specific url? can you share the connection url? (redact the sensitive information like username and password before sharing)

  • Why do you want to use IPs instead of setting up hostnames?

  • How can you confirm that you are not connecting to the Database? Are you facing any error? If yes, please share the error message.

  • Please share output of rs.conf() and rs.status().

I would recommend you go through below thread as a similar has been discussed in that post.

Regards,
Tarun

1 Like