How to back up specific sets from a namespace

How to back up specific sets from a namespace


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.20.0). A feature request to add such feature is tracked under AER-5163.


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 -n foobar -s $setname -d ~/backup_foobar_dir/$setname & ) ; done
for setname in ~/backup_foobar_dir/* ; do ( asrestore -h -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.


  • 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.




June 21 2019