Articles in this section

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). You may pass in a comma-separated list of sets to back up. Starting with asbackup 3.9.0, server version 5.2 or later, multi-set backup is supported.

Method

For a signle set backup:

The most basic form of running asbackup is to just specify the cluster to backup (--host), the namespace (--namespace), sets(--sets) to backup as well as the local directory for the backup files (--directory).
 

For a multi-sets backup:

The sets to backup should pass in a comma-separated list of sets (version 3.6.1+). Note that multi-set backup cannot be used with --filter-exp.
 

Another solution to backup multi-sets 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.

Applies To Earliest Version

Pre 4.9

Applies To Latest Version

5.1
Was this article helpful?
0 out of 0 found this helpful