2
votes

I have confusion on what I need to do here. I am new to Mongo. I have set up a small Mongo server on Amazon EC2, with EBS volumes, one for data, one for logs. I need to do a backup. It's okay to take the DB down in the middle of the night, at least currently.

Using the boto library, EBS snapshots and python to do the backup, I built a simple script that does the following:

sudo service mongodb stop run backup of data run backup of logs sudo service mongodb start

The script ran through and restarted, but I noted in the AWS console that the snapshots are still being created, even through boto has come back, but Mongo has restarted. Certainly not ideal.

I checked the Mongo docs, and found this explanation on what to do for backups:

http://docs.mongodb.org/ecosystem/tutorial/backup-and-restore-mongodb-on-amazon-ec2/#ec2-backup-database-files

This is good info, but a bit unclear. If you are using journaling, which we are, it says:

If the dbpath is mapped to a single EBS volume then proceed to Backup the Database Files.

We have a single volume for data. So, I'm assuming that means to bypass the steps on flushing and locking. But at the end of Backup the Database Files, it discusses removing the locks.

So, I'm a bit confused. As I read it originally, then I don't actually need to do anything - I can just run the backup, and not worry about flushing/locking period. I probably don't need to take the DB down. But the paranoid part of me says no, that sounds suspicious.

Any thoughts from anyone on this, or experience, or good old fashioned knowledge?

1

1 Answers

7
votes

Since you are using journaling, you can just run the snapshot without taking the DB down. This will be fine as long as the journal files are on the same EBS volume, which they would be unless you symlink them elsewhere.

We run a lot of mongodb servers on Amazon and this is how we do it too.