0
votes

I tried Mongodump on AWS EC2 instance. There is no error, but the files are not dumped.

[ec2-user ~]$ sudo mongodump --host localhost:27017 --db test--out /var/backups/

connected to: localhost:27017
2017-01-19T01:56:05.608+0000 DATABASE: test  to     /var/backups/test

How to take a dump inside AWS EC2? The database is in data/db folder.

2

2 Answers

1
votes

In my mongodb folder first I made a folder for backups:
sudo mkdir backups

Then used 777 just in case, later I changed it to 766
sudo chmod 777 -R backups

sudo mongodump -h ec2-xx-xx-xxx-xxx.compute-1.amazonaws.com --port 27017 --db your_db_name_here -u your_username_here -p your_password_here --out backups/

Of course change your host also
and if you want backup zipped then add this
--oplog --gzip

Hope that helps

0
votes

First you should set required permission for out directory

sudo chmod 777 -R /var/backups

then

sudo mongodump --port 27017 --db test --out /var/backups/