Skip to content

Commit

Permalink
PBM-1141 Documented deleted backup by type
Browse files Browse the repository at this point in the history
modified:   docs/usage/delete-backup.md
	modified:   docs/usage/schedule-backup.md
	modified:   mkdocs-base.yml
  • Loading branch information
nastena1606 committed Feb 26, 2024
1 parent 7c62233 commit 0452383
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 9 deletions.
6 changes: 4 additions & 2 deletions docs/reference/pbm-commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ The command accepts the following flags:

## pbm delete-backup

Deletes the specified backup snapshot or all backup snapshots that are older than the specified time. The command deletes backups that are not running regardless of the remote backup storage being used.
Deletes the specified backup snapshot or backup snapshots of one or several types that are older than the specified time. The command deletes backups that are not running regardless of the remote backup storage being used.

The following is the command syntax:

Expand All @@ -159,7 +159,8 @@ The command accepts the following flags:

| Flag | Description |
| ------------------------ | ----------------------- |
| `--older-than=TIMESTAMP` | Deletes backups older than date / time specified in the format:<br> - `%Y-%M-%DT%H:%M:%S` (e.g. 2020-04-20T13:13:20) or <br> - `%Y-%M-%D` (e.g. 2020-04-20)|
| `--older-than=TIMESTAMP` | Deletes backups older than date / time specified in the format:<br> - `%Y-%M-%DT%H:%M:%S` (e.g. 2023-04-20T13:13:20) or <br> - `%Y-%M-%D` (e.g. 2023-04-20)|
| `--type=TYPE` | Deletes backups of the specified type. Multiple values are accepted as comma-separated list. Must be used together with the `-older-than` flag. Available starting with version 2.4.0|
| `--force` | Forcibly deletes backups without asking for user's confirmation |
| `--yes` | Deletes backups without asking for user's confirmation |

Expand All @@ -182,6 +183,7 @@ The command accepts the following flags:
| `--force` | Forcibly deletes oplog slices without asking a user’s confirmation |
| `-o`, `--out=json` | Shows the output as either the plain text (default) or a JSON object. Supported values: `text`, `json`. |
| `--yes` | Deletes backups without asking for user's confirmation |
| `--dry-run` | Prints the list of oplog slices to be deleted without deleting them. You can use the flag to check what exactly will be deleted. Available starting with version 2.4.0. |

## pbm describe-backup

Expand Down
29 changes: 25 additions & 4 deletions docs/usage/delete-backup.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
# Delete backups

Use [`pbm delete-backup`](../reference/pbm-commands.md#pbm-delete-backup) to delete backup snapshots and [`pbm delete-pitr`](../reference/pbm-commands.md#pbm-delete-pitr) to delete point-in-time recovery oplog slices. Use the `pbm cleanup --older-than` command to [automate backup storage cleanup](schedule-backup.md#backup-storage-cleanup).
To limit the amount of space for old backups on the backup storage, you need to delete these backups periodically. You can do this in the following ways:

## Delete outdated data
- [delete backup snapshots and point-in-time recovery oplog slices simultaneously](#clean-up-outdated-data). This way you can [automate storage cleanup](schedule-backup.md#backup-storage-cleanup).
- [delete backup snapshots](#delete-backup-snapshots) and [point-in-time oplog slices](#delete-oplog-slices) separately. This gives you more control over the deletion flow. However, these are manual operations.


## Clean up outdated data

!!! admonition "Version added: [2.1.0](../release-notes/2.1.0.md)"

You can use the `pbm cleanup --older-than` command to delete both outdated backup snapshots and point-in-time recovery oplog slices. This simplifies the [automation of the backup rotation](schedule-backup.md#backup-storage-cleanup).
To delete both outdated backup snapshots and point-in-time recovery oplog slices, use the [`pbm cleanup --older-than`](../reference/pbm-commands.md#pbm-cleanup) command. This simplifies the [automation of the backup rotation](schedule-backup.md#backup-storage-cleanup).

The timestamp you specify for the `--older-than` flag must be in the following format:

Expand Down Expand Up @@ -118,7 +122,7 @@ Here's how the cleanup works:
### Behavior
You can delete either a specified backup snapshot or all backup snapshots older than the specified time. Starting with version 2.0.0, you can also delete [selective backups](../features/selective-backup.md).
You can delete either a specified backup snapshot or backup snapshots created before the specified time. Starting with version 2.0.0, you can delete [selective backups](../features/selective-backup.md). Starting with version [2.4.0](../release-notes/2.4.0.md), you can delete backups by type; for example, delete all physical backups that are older than the specified time.
=== "A specific backup"
Expand Down Expand Up @@ -166,6 +170,20 @@ You can delete either a specified backup snapshot or all backup snapshots older
2021-04-21T02:16:33Z
```
=== "Specific types of backups"
To delete backups of a specific type that were created before the specified time, run the `pbm delete backup` with the `--type` and the `--older-than` flags. Note that you must specify both flags to delete backups of the desired type.
You can delete several types of backups, for example, logical and selective, by passing comma-separated values for the `--type` flag.
PBM deletes all backups that don't serve as the base for restore to the specified timestamp.

#### Example

You have the following list of backups:



By default, the ``pbm delete-backup`` command asks for your confirmation to proceed with the deletion. To bypass it, add the `-f` or
`--force` flag.

Expand Down Expand Up @@ -211,3 +229,6 @@ To view oplog slices, run the [`pbm list`](../reference/pbm-commands.md#pbm-list
```

To enable [point-in-time recovery](pitr-tutorial.md) from the most recent backup snapshot, Percona Backup for MongoDB does not delete slices that were made after that snapshot. For example, if the most recent snapshot is `2021-07-20T07:05:23Z [restore_to_time: 2021-07-21T07:05:44]` and you specify the timestamp `2021-07-20T07:05:44`, Percona Backup for MongoDB deletes only slices that were made before `2021-07-20T07:05:23Z`.

To verify what oplog slices will be deleted without yet deleting them, run the ``pbm delete-pitr`` command with the `--dry-run` flag.

4 changes: 3 additions & 1 deletion docs/usage/schedule-backup.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ Previous backups are not automatically removed from the backup storage. You need

!!! admonition "Version added: [2.1.0](../release-notes/2.1.0.md)"

Starting with version 2.1.0, you can use the `pbm cleanup --older-than` command to delete outdated backup snapshots and point-in-time recovery oplog slices. You can configure a `cron` task to automate storage cleanup by specifying the following command in the `crontab` file:
Starting with version 2.1.0, you can use the [`pbm cleanup --older-than`](../reference/pbm-commands.md#pbm-cleanup) command to delete outdated backup snapshots and point-in-time recovery oplog slices. Learn more about how PBM deletes outdated data in the [Clean up outdated data](delete-backup.md#clean-up-outdated-data) section.

You can configure a `cron` task to automate storage cleanup by specifying the following command in the `crontab` file:

```{.bash data-prompt="$"}
$ $ /usr/bin/pbm cleanup -y --older-than 30d --wait
Expand Down
4 changes: 2 additions & 2 deletions mkdocs-base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ nav:
- install/backup-storage.md
- install/start-pbm-agent.md
- Backup and restore:
- Via the command line:
# - Via the command line:
- Make a backup : "usage/start-backup.md"
- Restore a backup: usage/restore.md
- Make a point-in-time restore: usage/pitr-tutorial.md
Expand All @@ -187,7 +187,7 @@ nav:
- usage/restore-progress.md
- usage/oplog-replay.md
- usage/logs.md
- Via web interface:
# - Via web interface:
- Backup management via PMM: pmm.md
- Administer PBM:
- 'Overview': manage/overview.md
Expand Down

0 comments on commit 0452383

Please sign in to comment.