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.
-
Stop the Aerospike service.
Terminal window systemctl stop aerospike -
Update the
aerospike.conf
file.Add or remove
namespace
contexts as needed. -
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.
-
Stop application traffic for the namespace to be renamed.
-
Back up the namespace to be renamed.
You can use
asbackup
andasrestore
for on-demand cluster backup.Perform the following steps on the cluster nodes one at a time.
-
Stop the Aerospike service.
Terminal window systemctl stop aerospike -
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
ordd
Linux utilities. The Zeroize Multiple SSDs Simultaneously Knowledge Base article has more information about deleting data from raw devices. -
Modify
aerospike.conf
to update the namespace context. -
Start the Aerospike service.
Terminal window systemctl start aerospike -
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.
Related topics
- Storage engine configures if records are persisted and where.
- Configure a data retention policy to determine how long records are kept after initially written.
- Data durability determines how many replica copies of a record to keep in the cluster.
- Configure strong consistency describes how to set up SC mode for transactions.
- For a complete list of namespace configuration parameters see the Configuration reference.