cbbackupmgr remove
Removes a backup repository from the backup archive
SYNOPSIS
cbbackupmgr remove [--archive <archive_dir>] [--repo <repo_name>] [--backups <backup_range>] [--obj-access-key-id <access_key_id>] [--obj-cacert <cert_path>] [--obj-endpoint <endpoint>] [--obj-no-ssl-verify] [--obj-region <region>] [--obj-staging-dir <staging_dir>] [--obj-secret-access-key <secret_access_key>] [--s3-force-path-style] [--s3-log-level <level>]
DESCRIPTION
Removes a backup repository from the backup archive. All contents of the specified repository will be deleted from disk.
OPTIONS
Below are a list of parameters for the remove command.
- -a,--archive <archive_dir>
-
The location of the archive directory. If the archive is stored in S3 prefix the archive path with
s3://${BUCKET_NAME}/
. - -r,--repo <repo_name>
-
The name of the backup repository to remove.
- --backups <backup_range>
-
This flag will take either a single backup directory (e.g 2019-08-23T09_36_56.957232625Z) or a comma separated range containing the start/end date of the backups to be deleted (inclusive). The accepted formats are
dd-mm-yy
, backup directory name or backup index, with the first backup being number 0. To read more about format go to the section BACKUP RANGES.
Cloud integration
Required
- --obj-staging-dir <staging_dir>
-
When performing an operation on an archive which is located in the cloud such as AWS, the staging directory is used to store local meta data files. This directory can be temporary (it’s not treated as a persistent store) and is only used during the backup. NOTE: Do not use
/tmp
as theobj-staging-dir
. SeeDisk requirements
in cbbackupmgr-cloud for more information.
Optional
- --obj-access-key-id <access_key_id>
-
The access key id which has access to your chosen object store. This option can be omitted when using the shared config functionality provided by your chosen object store. Can alternatively be provided using the
CB_OBJSTORE_ACCESS_KEY_ID
environment variable. - --obj-cacert <cert_path>
-
Specifies a CA certificate that will be used to verify the identity of the object store being connected to.
- --obj-endpoint <endpoint>
-
The host/address of your object store.
- --obj-no-ssl-verify
-
Skips the SSL verification phase when connecting to the object store. Specifying this flag will allow a connection using SSL encryption, but you are vulnerable to a man-in-the-middle attack.
- --obj-region <region>
-
The region in which your bucket/container resides. For AWS this option may be omitted when using the shared config functionality. See the AWS section of the cloud documentation for more information.
- --obj-secret-access-key <secret_access_key>
-
The secret access key which has access to you chosen object store. This option can be omitted when using the shared config functionality provided by your chosen object store. Can alternatively be provided using the
CB_OBJSTORE_SECRET_ACCESS_KEY
environment variable.
AWS S3 Options
Optional
- --s3-force-path-style
-
By default the updated virtual style paths will be used when interfacing with AWS S3. This option will force the AWS SDK to use the alternative path style URLs which are often required by S3 compatible object stores.
- --s3-log-level <level>
-
Set the log level for the AWS SDK. By default logging will be disabled. Valid options are
debug
,debug-with-signing
,debug-with-body
,debug-with-request-retries
,debug-with-request-errors
, anddebug-with-event-stream-body
.
BACKUP RANGES
The remove command accepts a pair of dates or indices using the --backups
argument
which can be used to refine which backups in the repository to remove.
When given the backup range '0,5' remove will delete all of the backups in chronological order starting from the first backup, finishing with the fifth backup.
When given the backup range '20-08-2019,23-08-2019' remove will delete all the backups which fall within these two dates. Note that the format must be 'day-month-year' this means that '01-30-19' is an invalid date and will be rejected by merge.
Remove also accepts a backup range using the names of backups e.g. '2019-08-23T09_36_56.957232625Z'. Therefore, given the backup range '2019-08-20T11_39_34.232308323Z, 2019-08-23T09_36_56.957232625Z' remove will delete all backups which fall within these two backups (inclusive).
EXAMPLES
The remove command is used to remove a backup repository from disk. Below is an example of how to run the remove command. The /data/backup directory is used as the archive directory and the backup repository is named "example".
$ cbbackupmgr list -a /data/backup Size Items Name 91.52MB - / 91.52MB - + example 91.52MB - + 2016-02-12T12:45:33.329408761-08:00 91.52MB - + travel-sample 322B 0 bucket-config.json 91.51MB 31569 + data 91.51MB 31569 shard_0.fdb 2B 0 full-text.json 10.00KB 8 gsi.json 1.72KB 1 views.json $ cbbackupmgr remove -a /data/backup -r example Backup repository `example` deleted successfully from archive `/tmp/backup` $ cbbackupmgr list -a /data/backup Size Items Name 0B - /
The remove command can also be use to remove backups from inside a repository given the following archive:
$ cbbackupmgr info -a /data/backup -r example Name | Size | # Backups | example | 36.01MB | 3 | + Backup | Size | Type | Source | Range | Events | Aliases | Complete | + 2019-09-18T11_13_58.136188+01_00 | 12.00MB | FULL | http://localhost:8091 | N/A | 0 | 1 | true | + 2019-09-19T11_14_29.026324+01_00 | 12.00MB | INCR | http://localhost:8091 | N/A | 0 | 1 | true | + 2019-09-19T11_14_40.410627+01_00 | 12.00MB | INCR | http://localhost:8091 | N/A | 0 | 1 | true | + 2019-09-20T11_14_43.410627+01_00 | 12.00MB | INCR | http://localhost:8091 | N/A | 0 | 1 | true |
We can delete the first two backups using indices range such as 0,1:
$ cbbackupmgr remove -a ~/backup_repo -r example --backups 0,1 Backup `2019-09-18T11_13_58.136188+01_00` deleted successfully from archive `/Users/carlosbetancourt/backup_repo` repository `example` Backup `2019-09-19T11_14_29.026324+01_00` deleted successfully from archive `/Users/carlosbetancourt/backup_repo` repository `example` All backups in range `0,1` were deleted
To delete only backup 2019-09-19T11_14_29.026324+01_0
we can do as follows:
$ cbbackupmgr remove -a ~/backup_repo -r example --backups 2019-09-19T11_14_29.026324+01_0 Backup `2019-09-19T11_14_29.026324+01_00` deleted successfully from archive `/Users/carlosbetancourt/backup_repo` repository `example`
To delete backups between the 18-09-2019 and 19-09-2019 we can do as follow:
$ cbbackupmgr remove -a ~/backup_repo -r example --backups 18-09-2019,19-09-2019 Backup `2019-09-18T11_13_58.136188+01_00` deleted successfully from archive `/Users/carlosbetancourt/backup_repo` repository `example` Backup `2019-09-19T11_14_29.026324+01_00` deleted successfully from archive `/Users/carlosbetancourt/backup_repo` repository `example` Backup `2019-09-19T11_14_40.410627+01_00` deleted successfully from archive `/Users/carlosbetancourt/backup_repo` repository `example` Backup `2019-09-19T11_14_29.026324+01_00` deleted successfully from archive `/Users/carlosbetancourt/backup_repo` repository `example` All backups in range `18-09-2019,18-09-2019` were deleted
Finally, we can also provide exact backup archive name ranges such as 2019-09-18T11_13_58.136188+01_00,2019-09-19T11_14_29.026324+01_00.
$ cbbackupmgr remove -a ~/backup_repo -r example --backups 2019-09-18T11_13_58.136188+01_00,2019-09-19T11_14_29.026324+01_00 Backup `2019-09-18T11_13_58.136188+01_00` deleted successfully from archive `/Users/carlosbetancourt/backup_repo` repository `example` Backup `2019-09-19T11_14_29.026324+01_00` deleted successfully from archive `/Users/carlosbetancourt/backup_repo` repository `example` All backups in range `2019-09-18T11_13_58.136188+01_00,2019-09-19T11_14_29.026324+01_00` were deleted
Removing data that is stored in AWS S3 is very similar to removing a local repository/backup, below is an example command which remove a given backup:
$ cbbackupmgr remove -a s3://storage/backup_archive -r backup_repo --obj-staging-dir ~/backup-archive --backups '2020-04-22T14_10_18.372643628+01_00' Backup `2020-04-22T14_10_18.372643628+01_00` deleted successfully from archive `backup_archive` repository `backup_repo`
DISCUSSION
The remove command is used to safely remove a backup repository from an archive. This command is provided because only the cbbackupmgr utility should ever be used to access or modify a backup archive. Removing a backup repository will remove data permanently from disk. Data is not recoverable once it has been removed.
ENVIRONMENT AND CONFIGURATION VARIABLES
- CB_ARCHIVE_PATH
-
Specifies the path to the backup archive. If the archive path is supplied as a command line argument then this value is overridden.
- CB_OBJSTORE_STAGING_DIRECTORY
-
Specifies the path to the staging directory. If the
--obj-staging-dir
argument is provided in the command line then this value is overridden. - CB_OBJSTORE_REGION
-
Specifies the object store region. If the
--obj-region
argument is provided in the command line then this value is overridden. - CB_OBJSTORE_ACCESS_KEY_ID
-
Specifies the object store access key id. If the
--obj-access-key-id
argument is provided in the command line this value is overridden. - CB_OBJSTORE_SECRET_ACCESS_KEY
-
Specifies the object store secret access key. If the
--obj-secret-access-key
argument is provided in the command line this value is overridden. - CB_AWS_ENABLE_EC2_METADATA
-
By default cbbackupmgr will disable fetching EC2 instance metadata. Setting this environment variable to true will allow the AWS SDK to fetch metadata from the EC2 instance endpoint.
CBBACKUPMGR
Part of the cbbackupmgr suite