MongoDB using ec2-consistent-snapshot

7 Responses to “MongoDB using ec2-consistent-snapshot”


  1. Thomas says:

    Good Stuff!

  2. Brett says:

    This is a great solution, and you’ve packaged it in an easy to digest and executable way.

    The big question left on my end is how to restore from the snapshot in a similarly simple one step way?

  3. rodney says:

    Hi Brett,

    To restore you have to:
    1. Create the new volumes from the snapshots.
    2. Create a new instance with the same installed packages mdadm, xfsprogs, and mongodb
    3. Stop mongodb.
    4. Attached the new volumes similar to the old volumes devices. Should be on /dev/sdh /dev/sdi /dev/sdj /dev/sdk
    5. Copy the /etc/mdadm/mdadm.cnf and restart mdadm.
    6. Mount the directories.
    7. Start MongoDB.

    I like your idea. It would be nice to have a restore tutorial. 🙂

  4. Does the mongod.lock file exist when the snapshot is taken? I am concerned about having to a repair process as part of the restore. Do you have any experience with this?

  5. rodney says:

    Hi David,

    The mongod.lock file exists when snapshot is taken.
    I suggest to work first with a mongo with smaller size EBS volumes, perform the snapshots and restore procedure and do the same process for the production.

  6. Thanks, Rodney. I will check with 10gen to see if it is safe to remove the mongod.lock file without doing a repair. I am assuming it is, because of the fsync_lock, but I would like to get their confirmation.

  7. Dara Dan says:

    thanks for the great post. this is working fine when you have one shard, but what would you suggest when there are more shards. shouldnt we snapshot all the shards in the same time for consistency. imagine shards with global and sharded collections. would be great to hear your ideas 🙂

Share Your Thoughts