Question

Not able to resolve hostname provided for MongoDB managed database

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

Subscribe
Share

Submit an 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