0

Can I get by with standard EBS snapshots to back up my small MongoDB replica set?

I have a 3-member MongoDB replica set (~2GiB of data across several databases). I don't anticipate it to grow quickly, maybe 500MiB per month. Traffic is low, generally hovering around 30 queries per second with very infrequent bursts to 400 queries per second. Very few inserts & updates.

We're running MongoDB 3.0.8 with the MMAPv1 storage engine. The OS is Amazon Linux and the filesystem is ext4. Everything is on the same single disk/partition, which is all one mounted EBS volume.

I did some quick searching around and found recommendations for locking, flushing, LVM, xfs, etc., but all the examples given seem to apply to much larger, higher-traffic replica sets with multiple EBS volumes attached.

We are using journaling, at least the default same-partition, MMAPv1 journaling settings.

I'm considering only snapshotting the primary, but since replication rarely lags more than one second I suppose I could just pick any one to snapshot.

2

As everything including the journal is on the same storage device (i.e. your dbpath is not mapped to multiple EBS volumes) then you don't need flush and lock the database. This is only the case where these are spread across multiple volumes.

Assuming the journal is present on the same volume as the data files, a snapshot will capture both the state of the journal and of the data files atomically.

The best procedure/reference to follow is on this page: http://docs.mongodb.org/ecosystem/tutorial/backup-and-restore-mongodb-on-amazon-ec2/#ec2-backup-database-files

Just to be absolutely sure, you should run "mount" and "ls -laR" on your host to verify that everything is on the same volume before the backup.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.