Hi,
Let’s assume we have a sharded cluster with NO replicas (3xshards with primaries only).
Each shard has a separate disk for:
- data 5 TB (/dev/sdb) ,
- journal 20GB (/dev/sdc),
- logs 20GB (/dev/sdd).
I want to use snapshots (using cloud provider eg. GCP or AWS doesn’t matter) for creating backups of each shard - using scheduled snapshot mechanism (i.e. each disk from each shard will be snapshotted individually) - which may be done within an hour difference e.g. data disk at 12:00 and journal at 12:59 or opposite (that timings strictly depends on Cloud provider).
Now let’s assume that the cluster is always online - used heavily (many writes)! So I cannot LOCK it (cannot invoke db.fsyncLock()) .
MongoDB instruction states that
If the journal and data files are on the same logical volume, you can use a single point-in-time snapshot to capture a consistent copy of the data files.
If the journal and data files are on different file systems, you must use db.fsyncLock() and db.fsyncUnlock() to ensure that the data files do not change, providing consistency for the purposes of creating backups.
So in my specific scenario (no replicas + cannot lock the DB) the above condition for locking the database cannot be fulfilled.
The question is: will the above scenario even work as a backup method? Is it even possible to restore from such a backup (having data and journal on a separate disks and created at different time)? Will mongo even start?
Important assumption: I can live with inconsistency between the data and journal in the last hour (when the snapshots started to be created by the Cloud provider) - I want to have the data consistent before the snapshots started happening.
In other words: what does it mean in MongoDB manual:
… you must use db.fsyncLock() and db.fsyncUnlock() to ensure that the data files do not change, providing consistency for the purposes of creating backups.
If any more info is needed please say.
All the best folks!