Help with mongodump

Hello. I have been strugling with this for days now so hoping someone can help me. I have a free plan on Atlas abd i’m trying to get a dump of my database via the CLI but failing every time. Atlas says I can use the command:

mongodump --uri mongodb+srv://admin:<PASSWORD>@cluster0.lab0q.mongodb.net/<DATABASE> 

but I can’t get it to recognise the --uri option.

I am using a Ubuntu client machine and went through the install process here https://docs.mongodb.com/mongocli/master/install but no luck.

Is there an easier way to get my data out of this? I currently have no means of backing up my data.

Thanks

Post a screenshot of what you are trying that shows the issues you are getting.

Without an exact error message we cannot really help.

Just in case, and are placeholders and must be replaced with your real admin user password and a real database name. It is the safest to use test as the database name if you are unsure.

If you look at the documentation of mongodump at https://docs.mongodb.com/database-tools/mongodump/ you will notice in the examples that they have an equal sign between –uri and the actual URI.

1 Like

Thanks for your response.

If I post a screenshot it will reveal my connection info so i’ll paste from the command line below

I have now followed the instructions on this page to install the Mongo database tools

I then try the following command along with the equal sign, thank you
mongodump -uri=‘mongodb+srv://<MY_USER>:<MY_PASS>@cluster0.lab0q.mongodb.net/’

I then get
2021-01-09T05:22:28.859+0000 warning: Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused

My Linux box has 27017 outbound allowed. My application wouldn’t work without this. And I have set up Atlas to allow connections from this IP, again my app wouldn’t work without this. So I’m not sure why it is saying “connection refused”

Thanks

I have now managed to get my data out.

In the end I used the command:

mongodump “mongodb+srv://cluster0.lab0q.mongodb.net/<my_db>” --username <my_username>

from within the downloaded version of the Windows MongoDB Tools
mongodb-database-tools-windows-x86_64-100.2.1

Thanks

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.