Report this

What is the reason for this report?

Not able to resolve hostname provided for MongoDB managed database

Posted on July 1, 2021
Rajkishore J

By Rajkishore J

Cloud Support Engineer

Hi, I am not able to resolve the hostname provided for MongoDB Managed database from the host details provided from connection details.

tried dig command



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hello,

The MongoDB cluster does not resolve using standard dig requests to the hostname provided in the connection string, since the MongoDB cluster is hosted in multiple nodes and each has its own hostnames. To retrieve the node hostnames of a cluster using dig, you must specify the SRV record type in the request and prepend _mongodb._tcp. to the hostname in the connection string.

dig srv _mongodb._tcp.<cluster-hostname>

Also for nslookup you can try the below command

nslookup -type=SRV _mongodb._tcp.<cluster-hostname>

For more details: https://docs.digitalocean.com/products/databases/mongodb/how-to/connect/

Regards, Rajkishore

I also have the same issue

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.