EC2 backup and restore

MongoDB Cloud Manager can automate taking backups from EC2 volumes and since our data is in the cloud, why not use the Cloud Manager anyway.

If we can't use it for some reason, then we can write a script to take backups using the following steps:

  • Assuming that we have journaling enabled (and we really should) and we have already mapped dbpath containing data and journal files to a single EBS volume we need to first find the EBS block instances associated with the running instance using ec2-describe-instances.
  • The next step is to find the logical volumes that the dbpath of our mongodb database is mapped to using lvdisplay.
  • Once we identify the logical devices from the logical volumes, we can use ec2-create-snapshot to create new snapshots. We need to include each and every logical device that maps to our dbpath directory.

To verify that our backups work, we need to create new volumes based on the snapshots and mount the new volumes there. Finally the mongod process should be able to start mounting the new data and we should connect using mongo to verify these.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.159.229