How to back up specific sets from a namespace

The Aerospike Knowledge Base has moved to https://support.aerospike.com. Content on https://discuss.aerospike.com is being migrated to either https://support.aerospike.com or https://docs.aerospike.com. Maintenance on articles stored in this repository ceased on December 31st 2022 and this article may be stale. If you have any questions, please do not hesitate to raise a case via https://support.aerospike.com.

How to back up specific sets from a namespace

Context

The Aerospike backup utility asbackup can back up either a single set (using the -s flag), or all sets in a namespace (default when the -s flag is not provided). However, backing up a list of sets as a single operation is not yet supported (as of Aerospike Tools version 3.28.0). A feature request to add such feature is tracked under PROD-1204.

Solution

The current solution is to backup a single set at a time.

A scripted way that could potentially help is described below.

Since asbackup can be given a directory to write to and asrestore can be given a directory to read from, not just a single filename, this can take advantage of a for loop in a bash script.

mkdir ~/backup_foobar_dir
for setname in set2 set4 set5 ; do ( asbackup -F 200-h 127.0.0.1 -n foobar -s $setname -d ~/backup_foobar_dir/$setname & ) ; done
for setname in ~/backup_foobar_dir/* ; do ( asrestore -h 10.0.0.1:3000 -n bar -d $setname & ) ; done

These examples backup and restore each directory in a background subshell, so they will run in parallel. Multiple scan jobs might impact the performance of an Aerospike server, thus ensure to benchmark this approach prior to deploying in production. Refer to the documentation on Managing Scans for general recommendations on running scans.

Notes

  • Backing up a set will trigger a scan of the whole namespace containing the set.
  • In some situations, based on the size of the different sets being backed up and the size of the namespace containing those sets, it may be preferable to backup the whole namespace rather than scanning the it several times through different backups.

Keywords

BACKUP ASBACKUP RESTORE ASRESTORE SETS

Timestamp

July 2020

1 Like