10gen Announces MongoDB Backup Service

If you are already using MongoDB Monitoring Service, or MMS, the next logical step here is to sign up for their backup service. MongoDB Backup Service MBS is a cloud-based service provided by 10gen for backing up and restoring MongoDB. Engineered for MongoDB, it features point-in-time recovery and is hosted in reliable, redundant and secure data centers.

Update - I got access to MongoDB Backup Service and tried it out! Read more below.

MongoDB backup, own way

Before MBS was there, I spent some time setting up the backup scripts on one of my secondary servers in replica set, and it works very straight forward once set up: create backup archive and store in S3, and keep only 30 days worth of backups.

  • run mongodump --oplog -u user -p pass mongobackups
  • create backup-YYYYMMMDDHH.tar.bz2 file from mongobackups
  • run /usr/bin/s3put to move file to S3 storage
  • delete mongobackups folder
  • Configure S3 storage lifecycle:
    • Move to Glacier 1 day after creation date
    • Expiration (delete) 30 days after creation date
Read more about S3 storage lifecycle here.
#!/bin/sh
 
lockfile="/tmp/mongobackup.lock"
 
if [ -f $lockfile ]; then
  echo "Lock file exists! Mongo backup may still be running!"
  exit 1
fi
 
AWSKEY="put your key here"
AWSSEC="put your secret here"
S3BUCK="s3 bucket name"
 
date +"%d.%m.%Y - %H:%M" > $lockfile
mydate=`date +"%Y-%m-%d-%H%M%S"`
file="$mydate-mongodump.tar.bz2"
 
cd /home/ec2-user/
 
rm -f "$file" && mongodump --oplog -u mongoadminusername -p mongoadminpass
-o mongobackups && tar -jcf "$file" mongobackups && rm -rf mongobackups

/usr/bin/s3put -a "$AWSKEY" -s "$AWSSEC" -p "/home/ec2-user/"-r -b "$S3BUCK" "$file"
rm $file
rm -rf $lockfile

MBS as enterprise backup solution


Now, with MongoDB Backup Service around, users can backup huge collections and replica sets, securely and without a hassle. You install MongoDB backup agent in your data center, and after initial sync, agent streams encrypted and compressed oplog data to Backup Service. Snapshot will be created every 6 hours, multiple copies will be retained based on retention policy. Snapshots can be downloaded via secure copy or HTTPS. Two-factor authentication is required when using the MongoDB Backup Service.

Although several companies have tried and successfully built their own backup solutions for MongoDB, but service provided by 10gen has clear advantage: they built MongoDB and have best understanding how it works.

Key features in MBS

  • Data security - SSL, multi-factor authentication
  • High availability
  • Managed solution
  • Support Sharded Clusters
  • Low overhead
  • Convenient recovery
  • Unlimited free restores

MBS pricing model

Pay for what you use. Backup Service is billed via credit card on a monthly basis. The cost to backup a replica set is calculated as follows
  • Oplog processing: $2 / GB
  • Snapshot creating: $0.01 / GB
  • Snapshot storage: $0.08 / GB / month
Restores are free, enabling you to use backups to seed new environments for test, development, analytics and other use cases without incurring additional cost.

Installation and enabling backups

After just 12 hours of waiting in the queue, my account was enabled for MongoDB Backup Service. The activation code was sent to my phone via SMS, I entered this and also credit card information, accepted the terms & conditions, and voilá - I was taken to a download page.

MongoDB recommends running the backup agent on the servers other than your replica set, to avoid resource contention. I installed the agent on secondary server, simply because it has enough headroom, and this is where my backup script was also running.

Install was straight forward as always

1. for Amazon Linux, I downloaded 64-bit version and extracted it to a folder backup-agent.
2. Run agent with nohup command
sudo nohup ./backup-agent > /var/log/backup-agent.log 2>&1 &
3. Go to Backup tab in your MMS, and make Replica Set status Enabled. They actually recommend connecting to any secondaries. Enter credentials if needed.
4. Keep an eye on the log

tail -f /var/log/backup-agent.log


After a minute or so, 10gen sent notification email stating that replica set backup has started. Checked the dashboard and waited a bit, and status was completed.
Whole operation was a breeze, taking 5 minutes to set up, plus waiting for backup to complete.

MongoDB Backup Service - Billing Tab

Conclusion

What 10gen has created is absolutely perfect - provide flexible, affordable, secure, unlimited cloud backup solutions of your MongoDB replica set with minimal administrative overhead, and it works for your small Replica Sets and even on Sharded Clusters. Well done, 10gen!

Read more about MongoDB Backup Service and sign up here to get access to limited release of MBS.

About 10gen

10gen is the company behind MongoDB, the leading NoSQL database. MongoDB (named from "huMONGOus," meaning "extremely large") is the open-source, document database that is reshaping the market due to the popularity of its agile and scalable approach among developers and IT professionals. 10gen leads MongoDB development, supports the large and growing MongoDB community, provides commercial subscriptions including support, and offers consulting and training.

Comments

Popular posts from this blog

Stubbing and Mocking Static Methods with PHPUnit

Enable HTTP/2 Support in AWS ELB

How To Attach Your EBS volume to multiple EC2 instances