I am unable to connect to my MongoDB Atlas cluster using the mongosh
shell or any other MongoDB client. The error I’m encountering is:
Error: querySrv ENOTFOUND _mongodb._tcp.cluster.mongodb.net
Additionally, when I try to resolve the hostname (cluster0-shard-00-00.mongodb.net
) using nslookup
or ping
, I receive the following error:
cluster0-shard-00-00.mongodb.net: nodename nor servname provided, or not known
Steps I’ve Taken*
- Verified the Connection String:
I am using the correct connection string provided in the MongoDB Atlas dashboard:
mongodb+srv://:@cluster0.mongodb.net/?retryWrites=true&w=majority
2. Checked DNS Settings:
I have set my DNS servers to Google Public DNS(8.8.8.8
and 8.8.4.4
).
I have flushed the DNS cache using:
sudo dscacheutil -flushcache sudo killall -HUP mDNSResponder
- Tested Connectivity:
I attempted to usetelnet
to connect to the cluster’s IP address, but the hostname resolution failed.
I also tried using a direct connection string (replacingmongodb+srv
withmongodb
), but the issue persists. - Checked Firewall and Network:
My firewall allows outbound connections to port27017
.
My IP address is whitelisted in the MongoDB Atlas dashboard under Network Access
Additional Information:
MongoDB Atlas Plan Free Tier (M0)
Operating System: macOS
MongoDB Shell Version: mongosh 2.4.2
Request:
Could you please assist me in resolving this DNS resolution issue? Specifically:
- Are there any known issues with the SRV records for my cluster?
- Is there a way to bypass the SRV records and connect directly to the cluster?
- Are there any additional steps I can take to troubleshoot this issue?
Thank you for your assistance!