We have a mongodb running on only one AWS EC2 (no master-slave, no replica sets). The data files are stored in a separate EBS volume. So, what is the best way to backup and restore the data without locking it from writing (sync & lock)? Or we must have master-slave to achieve it?
As long as you have journaling enabled (the default in MongoDB 2.0+), you can take advantage of EBS snapshots to get a consistent dump of the data files without the need for fSyncLock()
.
This is covered in more detail in the EC2 Backup & Restore documentation on the MongoDB site.