0

I have an application running on a Parse Server and another server where MongoDB runs. Both VMs are under Azure (Ubuntu VMs). A few weeks back, I wrote a db backup bash script which is run by crontab once a day, every day.

Here's the script:

#!/bin/bash MONGO_DATABASE="db" MONGO_HOST="127.0.0.1" MONGO_PORT="portNo" TIMESTAMP=`date +%d-%m-%Y--%H:%M:%S` MONGODUMP_PATH="/usr/bin/mongodump" BACKUPS_DIR="/datadrive/mongodb/backups/" BACKUP_NAME="$TIMESTAMP" # mongo admin --eval "printjson(db.fsyncLock())" # $MONGODUMP_PATH -h $MONGO_HOST:$MONGO_PORT -d $MONGO_DATABASE sudo $MONGODUMP_PATH -d $MONGO_DATABASE # mongo admin --eval "printjson(db.fsyncUnlock())" sudo mv dump $BACKUP_NAME sudo tar -zcvf $BACKUPS_DIR/$BACKUP_NAME.tgz $BACKUP_NAME sudo rm -rf $BACKUP_NAME sudo find $BACKUPS_DIR/ -type f -mtime +0 -name '*.tgz' -delete 

Ever since, I noticed a huge increment on the server's resources consumption, which costs twice as much than without the backup system!

My db's size is about 7GB and growing! What should I do in order to have a backup system that's CPU or otherwise efficient?

1
  • incremental backups can be great, but for mongodb the issue is tricky. there isnt really a convenient way to do it without paying for expensive services (mongodb cloud) or writing your own scripts (tech.willhaben.at/mongodb-incremental-backups-dff4c8f54d58) Commented Feb 5, 2018 at 8:49

1 Answer 1

1

What should I do in order to have a backup system that's CPU or otherwise efficient?

Maybe you can deploy Mongodb replica sets, then use another VM to run backup crontab.

Also, you can run crontab in free time.

3
  • What about any paid services? Are there any? Commented Feb 6, 2018 at 18:50
  • @SotirisKaniras Maybe you can use Azure backup to backup that disk every day. Commented Feb 8, 2018 at 2:05
  • Hi Jason, I would like utilize Azure backup service that should backup mongodb replicaset. Could you please highlight some points on that how to proceed. I am new to azure and would like to backup the mongodb via azure. Commented Apr 3, 2019 at 8:18

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.