Hi @ecoatoms,
Oplog slicing runs periodically by PBM itself (internally). The period controlled by pitr.oplogSpanMin parameter. For example, if it is 1, the first and following oplog ranges are sliced every minute.
By pbm status
, you can check if oplog slicing is enabled:
[...]
PITR incremental backup:
========================
Status [ON]
[...]
As for v2.2.1, it requires a Full Logical Backup to start slicing. Otherwise, you should see an error like:
[...]
PITR incremental backup:
========================
Status [ON]
! ERROR while running PITR backup: 2024-10-11T01:28:40.000+0300 E [rs0/rs0:27017] [pitr] init: catchup: no backup found. full backup is required to start PITR
[...]
With the pitr.oplogOnly, PBM ignores missed valid base snapshot and does slicing anyway.
For example, I enabled oplogOnly and, after some time, ran Full Logical Backup:
[...]
PITR incremental backup:
========================
Status [ON]
Currently running:
==================
(none)
Backups:
========
FS /var/pbm
Snapshots:
2024-10-20T15:35:54Z 16.96KB <logical> [restore_to_time: 2024-10-20T15:35:59Z]
PITR chunks [59.78KB]:
2024-10-20T15:36:00Z - 2024-10-20T15:38:11Z
2024-10-20T15:34:41Z - 2024-10-20T15:35:59Z (no base snapshot)
The 2024-10-20T15:34:41Z - 2024-10-20T15:35:59Z (no base snapshot) is an oplog range without a valid base snapshot.
The 2024-10-20T15:36:00Z - 2024-10-20T15:38:11Z is an oplog range that is based on a valid snapshot:
2024-10-20T15:35:54Z 16.96KB <logical> [restore_to_time: 2024-10-20T15:35:59Z]
2024-10-20T15:35:54Z is the backup name (base-snapshot value).
[restore_to_time: 2024-10-20T15:35:59Z] is the actual restore time of the backup (UTC time in ISO-8601). As you can see, it is 1 second before the first oplog range (backup-based).
To restore to a time, you need to specify the --base-snapshot
and --time
parameters. For example, let’s imagine we have:
- physical backup 2024-11-20T16:35:51Z 1GB <physical> [restore_to_time: 2024-11-20T16:40:25Z]
- oplog range: 2024-10-20T15:36:00Z - 2024-11-21T13:01:11Z
To restore to 2024-11-20T17:00:00Z, you should run:
pbm restore --base-snapshot="2024-11-20T16:35:51Z" --time="2024-11-20T17:00:00"
.
2024-11-20T16:35:51Z - backup name.
2024-11-20T17:00:00 - time in UTC (but without UTC designator (“Z”))
*NOTE: do not forget to shut down all mongos before running the command.
Point-in-Time Restore first restores a base-snapshot (as for v2.2.1, if you do not provide the option, PBM will use the most recent Full Logical Backup). Since v2.2.0, you can use a Full Physical or Incremental backup for the value.
We are going to extend the valid base snapshot to Full Physical and Incremental backups ([PBM-1162] Make physical/incremental backup as valid base-snapshot). Don’t miss it