Incremental backups

Making full backups every time may be viable for some deployments, but as the size reaches a certain threshold, full backups take too much time and space.

At this point, we will want to make full backups every once in a while (maybe one per month, for example) and incremental backups in-between (for example, nightly).

Both Ops Manager and Cloud Manager support incremental backups, and if we get to this size, it may be a good idea to use a tool to make our backups instead of rolling out our own.

If we don't want to (or can't) use these tools, we have the option of restoring via the oplog, as follows:

  1. Make a full backup with any method that was described previously
  2. Lock writes on the secondary server of our replica set
  3. Note the latest entry in the oplog
  4. Export the entries in the oplog after the latest entry in the oplog:
> mongodump --host <secondary> -d local -c oplog.rs -o /mnt/mongo-oldway_backup
--query '{ "ts" : { $gt : Timestamp(1467999203, 391) } }'
  1. Unlock writes on the secondary server

To restore, we can use the oplog.rs file that we just exported, and use mongorestore with the option --oplogReplay:

> mongorestore -h <primary> --port <port> --oplogReplay <data_file_position>
This method requires locking writes, and may not work in future versions.

An even better solution is to use the Logical Volume Management (LVM) filesystem with incremental backups, but this depends on the underlying LVM implementation, which we may or may not be able to tweak.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset