Question

cannot unmarshal DNS message when connecting to managed mongodb

I have a twice-daily backup script that connects to our managed mongo instance with mongodump and then rsyncs the data off-site.

The command is essentially:

mongodump --uri="mongodb+srv://$USERNAME:$PASSWORD@store-2e6b091b.mongo.ondigitalocean.com/$DB?authSource=admin&replicaSet=store&ssl=true" --gzip --archive="$FILENAME" --sslCAFile=$CA

After running fine for months, a few days ago it’s failing to connect to mongo with the error:

error parsing command line options: error parsing uri: lookup store-2e6b091b.mongo.ondigitalocean.com on 127.0.0.53:53: cannot unmarshal DNS message

Searching for the error message seems to imply that the DNS resolver doesn’t support the mongodb+srv:// lookup, but I’m not sure why it would suddenly stop working now after working fine for months.

Any help would be appreciated!


Submit an answer


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!

Sign In or Sign Up to Answer

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.

Bobby Iliev
Site Moderator
Site Moderator badge
September 9, 2022

Hi there,

Have you by any chance just enabled trusted sources for your database? This could cause a similar problem, if this is the case you would need to allow your IP address in your trusted hosts for your managed database:

https://docs.digitalocean.com/products/databases/mongodb/how-to/secure/

If this is not the case, and if you are still seeing the issue, I could suggest trying to change the DNS on the server that you are running the command from to 1.1.1.1 to see if it fixes the issue.

Let me know how it goes!

Best,

Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up