Backup Mongodb on EC2 through EBS snapshots – timing issue

amazon ec2amazon-ebsdatabase-backupmongodb

I'm following this guidance
http://docs.mongodb.org/ecosystem/tutorial/backup-and-restore-mongodb-on-amazon-ec2/

I have 4 EBS 1000 IOPS volumes assigned to instance.

These 4 volumes through MDADM assembled into software RAID10 array.

I want to do backups through EBS Snapshots as explained in the article above.

Question:

Mongodb says – that I need to

mongo shell>db.runCommand({fsync:1,lock:1}); -- this will lock the db for writing

….run snapshot creation…

mongo shell> db.$cmd.sys.unlock.findOne(); -- this will unlock the db for writing

So, do I need to unlock the DB for writing after I issued the command ec2-create-snapshot or after it's finished and the actual snapshot is created?

thanks,
Dmitry

Best Answer

do I need to unlock the DB for writing after I issued the comand ec2-create-snapshot or after it's finished and the actual snapshot is created

once the ec2-create-snapshot api cmd returns (with the snap-id), you are good to unlock for writing. However, you may see slightly degraded performance until snap is finished.

Amazon sends new writes during the snapshot creation time to temp storage, and this can be slower. Once snap is complete things converge. Keep in mind, the first ebs volume snap will take a while, but then the following snaps are incremental backups, and will finish much faster.

Related Topic