How do I rename an existing namespace in a cluster?
I have a cluster that has a namespace called
test. I intend to rename it to
bar but I get a warning as follows when I try to start up Aerospike. I have already tried to delete/truncate the data from client application before renaming.
WARNING (drv_ssd): (drv_ssd.c:2446) read header: device /dev/sdb previous namespace test now bar, check config or erase device FAILED ASSERTION (drv_ssd): (drv_ssd.c:3191) unable to read disk header /dev/sdb
Aerospike server relies on the device header definitions when starting up. The warning means that the namespace header does not match the name in Aerospike configuration and thus, the server fails to start up.
- Take a backup of the cluster data. See documentation on asbackup for more details.
- Stop Aerospike on the server node(s). If this is the only namespace in the cluster, it would be easier to bring the entire cluster down. If there are multiple namespaces, you could potentially do this in a rolling manner (1 node at a time) for clusters running the new cluster protocol introduced in version 3.13 and above.
- Delete the stored data for storage-engine device configured in the namespace that needs to be renamed. Simply delete the file if using a file. For raw devices, use blkdiscard or dd. Refer to the Zeroize Multiple SSD Simultaneously knowledge base article.
- Update Aerospike configuration to reflect the new name.
- Bring up Aerospike service on the cluster nodes.
- Once all nodes are on the new configuration with the new namespace name, restore data back into the cluster under the new namespace using the
-nflag in [asrestore].
- Adding a new namespace - How do I add a new namespace?
- Adding a new
strong-consistencynamespace - How do I add a strong consistency namespace?
- Removing a namespace - How do I remove a namespace?
RENAME NAMESPACE CHANGE UPDATE NAME