Question

Not able to resolve hostname provided for MongoDB managed database

Posted July 1, 2021 102 views
MongoDBDigitalOcean Managed MongoDB 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

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.

×
Submit an Answer
1 answer

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