Skip to content
Webinar - July 10: Cut Infra Costs by 80% with Smarter DRAM, NVMe & Cloud Storage StrategyRegister now

Manage namespaces

This page describes how to add, remove, and rename namespaces in Aerospike Database clusters.

Aerospike Database clusters contain one or more namespaces, similar to tablespaces in an RDBMS. Namespaces segregate data with different storage requirements, so you can optimize performance by keeping different kinds of data on different kinds of storage hardware.

Namespaces are defined in the main Aerospike configuration file. You can add, remove, or rename namespaces by editing aerospike.conf. You can configure namespaces for optimal performance in a variety of use cases by specifying a storage engine, a data retention policy, and other parameters.

The Aerospike server reads the configuration file when the server starts. For changes to take effect, stop the server, edit the configuration file, and restart the server. You can perform a rolling restart of cluster nodes to prevent server downtime.

We recommend that you back up your cluster before altering your namespace.

Minimum namespace configuration

The minimum requirement to configure a namespace is to provide it with a name. The following example creates an in-memory namespace with a 1GiB capacity.

namespace NAMESPACE-NAME {
storage-engine memory {
data-size 1G # memory pre-allocated for the data of this namespace
}
}

Add or remove a namespace

Perform the following steps on the cluster nodes one at a time.

  1. Stop the Aerospike service.

    Terminal window
    systemctl stop aerospike
  2. Update the aerospike.conf file.

    Add or remove namespace contexts as needed.

  3. Start the Aerospike service.

    Terminal window
    systemctl start aerospike

Rename an existing namespace

It’s not possible to rename an existing namespace in place, but you can create a new namespace with the desired name and move data from an existing namespace into it.

  1. Stop application traffic for the namespace to be renamed.

  2. Back up the namespace to be renamed.

    You can use asbackup and asrestore for on-demand cluster backup.

    Perform the following steps on the cluster nodes one at a time.

    1. Stop the Aerospike service.

      Terminal window
      systemctl stop aerospike
    2. Delete stored data for the namespace to be renamed.

      If your data is stored in a file, delete the file. For raw devices, use the blkdiscard or dd Linux utilities. The Zeroize Multiple SSDs Simultaneously Knowledge Base article has more information about deleting data from raw devices.

    3. Modify aerospike.conf to update the namespace context.

    4. Start the Aerospike service.

      Terminal window
      systemctl start aerospike
    5. Restore the old namespace’s data.

      When all the cluster nodes are restarted with the new namespace configuration, use the -n flag to to restore the data and specify the new namespace.

When the restore process is complete, the new namespace is ready to use.

Feedback