Page 1 of 1

MongoDB Backup

Posted: Tue Mar 19, 2019 8:23 pm
by maxpostal
Hi and Thanks for your free software.

I have a little question.
Is it possible to add a backup MongoDB database to a regular VestaCP backup?
Ubuntu 18.04.

Thank you in advance.

Re: MongoDB Backup

Posted: Wed Mar 20, 2019 2:31 am
by plutocrat
You could write a script for a cronjob to back it up to a local directory (say, /home/admin/dbbackups) and then that would be included in the vestacp backup.

eg
mongodump --host 1.2.3.4 -d mydb --username mayusername --password mypassword --out /home/admin/dbbackups/backup_$(date +%Y%m%d)

You'd probably want to then compress backups, and then to remove files over a certain age.

Re: MongoDB Backup

Posted: Wed Mar 20, 2019 7:45 am
by maxpostal
Ok, thank you. It's a good solution.