Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the easiest to backup a mongoDB deployed with mup?

Tags:

mongodb

meteor

I deployed my app on a Ubuntu server using mup deploy (https://github.com/arunoda/meteor-up) with the option "setupMongo": true in the mup.json file.

Everything works fine, and I would like to save the mongoDB database daily to FTP or S3, or to set a mongoDB replica to another server (to avoid copying the whole database every time, but it seems more complicated).

like image 633
Jerome Martin Avatar asked Jan 18 '26 06:01

Jerome Martin


1 Answers

If deployed with mup, you are in luck. You can find the steps here: https://github.com/xpressabhi/mup-data-backup

Here are the steps again:

MongoDB Data Backup deployed via mup

These commands run well only if meteor deployed with mup tool. Mup creates docker for mongodb hence taking backup becomes easy with these commands.

Backup

Take backup of running app data from docker then copy to local folder out of docker.

docker exec -it mongodb mongodump --archive=/root/mongodump.gz --gzip 
docker cp mongodb:/root/mongodump.gz mongodump_$(date +%Y-%m-%d_%H-%M-%S).gz

Copy backup to server

Move data to another server/local machine or a backup location

scp /path/to/dumpfile root@serverip:/path/to/backup

Delete old data from meteor deployment

Get into mongo console running in docker then drop current database before getting new data.

docker exec -it mongodb mongo appName
db.runCommand( { dropDatabase: 1 } )

Restore data to meteor docker

docker cp /path/to/dumpfile mongodb:/root/mongodump.gz
docker exec -it mongodb mongorestore --archive=/root/mongodump.gz --gzip
like image 146
Abhishek Maurya Avatar answered Jan 19 '26 20:01

Abhishek Maurya



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!