Compacts a backup to free disk space
cbbackupmgr compact [--archive <archive_dir>] [--repo <repo_name>] [--backup <backup_name>]
Compacts a backup in a backup repository in order to free up disk space. Should be run on each backup after it completes. The amount of freed disk space is displayed when the compaction completes.
Below are a list of parameters for the compact command.
- -a,--archive <archive_dir>
The location of the archive directory.
- -r,--repo <repo_name>
The name of the backup repository where the backup to be compacted is located.
- --backup <backup_name>
The name of the backup in the backup repository to compact or an index value which references an incremental backup to compact. Valid index values are any positive integer, "oldest", and "latest". If a positive integer is used then it should reference the index of the incremental backup to compact starting from the oldest to the most recent backup. For example, "1" corresponds to the oldest backup, "2" corresponds to the second oldest backup, and so on. Specifying "oldest" means that the index of the oldest backup should be used and specifying "latest" means the index of the most recent backup should be used.
- -t,--threads <num>
Specify the number of files to be compacted in parallel. By default it is set to 1, but it is recommended to set to match the number of CPUs in the system although it can vary depending on the available RAM.
The compact command is used to compact backups in order to free disk space and should be run after each backup. Below is an example of how to run the compaction command. The /data/backup directory is used as the archive directory and the backup repository is named "example".
$ cbbackupmgr config -a /data/backup -r example
$ cbbackupmgr backup -a /data/backup -r example \ -c 127.0.0.1:8091 -u Administrator -p password
$ cbbackupmgr list --archive /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 compact -a /data/backup -r example \ --backup 2016-02-12T12_45_33.329408761-08_00
Compaction succeeded, 58589184 bytes freed
The compact command can be run after a backup to reclaim any fragmented disk space in the backup data files. It should be noted however that compaction may be run during the backup itself if the fragmentation in the data file begins to grow too big. Although the compaction can run during the backup it is not guaranteed to be run once the backup has completed, hence the reason for the compact command.
Specifies the path to the backup archive. If the archive path is supplied as a command line argument then this value is overridden.
Specifies the path to the staging directory. If the
--obj-staging-dirargument is provided in the command line then this value is overridden.
Specifies the object store region. If the
--obj-regionargument is provided in the command line then this value is overridden.
Specifies the object store access key id. If the
--obj-access-key-idargument is provided in the command line this value is overridden.
Specifies the object store secret access key. If the
--obj-secret-access-keyargument is provided in the command line this value is overridden.
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.
The compact command will compact all shard-*.fdb files in the backup specified by the compact command.
Part of the cbbackupmgr suite