diff --git a/app/vmbackupmanager/README.md b/app/vmbackupmanager/README.md index 3fbde047e6..1ed76e41a6 100644 --- a/app/vmbackupmanager/README.md +++ b/app/vmbackupmanager/README.md @@ -150,6 +150,30 @@ The result on the GCS bucket. We see only 3 daily backups: ![daily](vmbackupmanager_rp_daily_2.png) +### Protection backups against deletion by retention policy + +You can protect any backup against deletion by retention policy with the `vmbackupmanager backups lock` command. + +For instance: + +```console +./vmbackupmanager backup lock daily/2021-02-13 -dst= -storageDataPath=/vmstorage-data -eula +``` + +After that the backup won't be deleted by retention policy. +You can view the `locked` attribute in backup list: + +```console +./vmbackupmanager backup list -dst= -storageDataPath=/vmstorage-data -eula +``` + +To remove protection, you can use the command `vmbackupmanager backups unlock`. + +For example: + +```console +./vmbackupmanager backup unlock daily/2021-02-13 -dst= -storageDataPath=/vmstorage-data -eula +``` ## API methods @@ -160,7 +184,23 @@ The result on the GCS bucket. We see only 3 daily backups: ```json [{"name":"daily/2023-04-07","size_bytes":318837,"size":"311.4ki","created_at":"2023-04-07T16:15:07+00:00"},{"name":"hourly/2023-04-07:11","size_bytes":318837,"size":"311.4ki","created_at":"2023-04-07T16:15:06+00:00"},{"name":"latest","size_bytes":318837,"size":"311.4ki","created_at":"2023-04-07T16:15:04+00:00"},{"name":"monthly/2023-04","size_bytes":318837,"size":"311.4ki","created_at":"2023-04-07T16:15:10+00:00"},{"name":"weekly/2023-14","size_bytes":318837,"size":"311.4ki","created_at":"2023-04-07T16:15:09+00:00"}] ``` - > Note: `created_at` field is in RFC3339 format. + > Note: `created_at` field is in RFC3339 format. + +* GET `/api/v1/backups/` - returns backup info by name. + Example output: + ```json + {"name":"daily/2023-04-07","size_bytes":318837,"size":"311.4ki","created_at":"2023-04-07T16:15:07+00:00","locked":true} + ``` + +* PUT `/api/v1/backups/` - update "locked" attribute for backup by name. + Example request body: + ```json + {"locked":true} + ``` + Example response: + ```json + {"name":"daily/2023-04-07","size_bytes":318837,"size":"311.4ki","created_at":"2023-04-07T16:15:07+00:00", "locked": true} + ``` * POST `/api/v1/restore` - saves backup name to restore when [performing restore](#restore-commands). Example request body: @@ -187,7 +227,13 @@ vmbackupmanager backup vmbackupmanager backup list List backups in remote storage -vmbackupmanager restore + vmbackupmanager backup lock + Locks backup in remote storage against deletion + + vmbackupmanager backup unlock + Unlocks backup in remote storage for deletion + +vmbackupmanager restore Restore backup specified by restore mark if it exists vmbackupmanager restore get diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 83a12664d7..4b5b8bd42f 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -54,6 +54,7 @@ The following tip changes can be tested by building VictoriaMetrics components f * FEATURE: [vmbackup](https://docs.victoriametrics.com/vmbackup.html): add `-s3StorageClass` command-line flag for setting the storage class for AWS S3 backups. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4164). Thanks to @justcompile for the [pull request](https://github.com/VictoriaMetrics/VictoriaMetrics/pull/4166). * FEATURE: [vmbackup](https://docs.victoriametrics.com/vmbackup.html): store backup creation and completion time in `backup_complete.ignore` file of backup contents. This allows determining the exact timestamp when the backup was created and completed. * FEATURE: [vmbackupmanager](https://docs.victoriametrics.com/vmbackupmanager.html): add `created_at` field to the output of `/api/v1/backups` API and `vmbackupmanager backup list` command. See this [doc](https://docs.victoriametrics.com/vmbackupmanager.html#api-methods) for data format details. +* FEATURE: [vmbackupmanager](https://docs.victoriametrics.com/vmbackupmanager.html): add commands for locking/unlocking backups against deletion by retention policy. See this [doc](https://docs.victoriametrics.com/vmbackupmanager.html#api-methods) for data format details. * FEATURE: [vmctl](https://docs.victoriametrics.com/vmctl.html): add support for [different time formats](https://docs.victoriametrics.com/Single-server-VictoriaMetrics.html#timestamp-formats) for `--vm-native-filter-time-start` and `--vm-native-filter-time-end` command-line flags. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4091). * BUGFIX: reduce the probability of sudden increase in the number of small parts on systems with small number of CPU cores.