Remove Namespace: Removing Namespace


#1

Question:

How do I remove a namespace from a cluster? We have one namespace which has been allocated space on the disk and we are not using it. We want to use that data for other namespaces. Can removal of namespace be done dynamically without taking the whole cluster down?

namespace ns1 {
    memory-size 21474836480
	replication-factor 2
	allow-versions false
	single-bin false
	default-ttl 2592000

    storage-engine device {
	    device /dev/sdb
		load-at-startup true
		data-in-memory false
		write-block-size 131072
	}
}

Answer:

For server versions 3.13.0.1 (with updated clustering protocol) and above

Confirm that you have upgraded to the Paxos v5 clustering protocol. See [1] for reference.

Admin> show config like paxos-protocol
~~~~~~~~~~~~~~~~~~~~Service Configuration~~~~~~~~~~~~~~~~~~~~
NODE          :   192.168.100.xxx:3000   192.168.100.yyy:3000   
paxos-protocol:   v5                     v5        

Removing (and adding) of a namespace can then be done by rolling restart of the Aerospike cluster nodes:

  1. Stop Aerospike service

sudo service aerospike stop

  1. Update Aerospike configuration by removing (or adding if relevant) the appropriate namespace configuration in the aerospike.conf file.

  2. Start Aerospike service.

  3. Repeat steps 1-3 on all nodes in the cluster keeping 5-10 second window between each nodes restarts to avoid any race condition on multiple nodes trying to join the cluster at the same time.

Workaround for server versions prior to 3.13.0.1

Unfortunately, there is no way to add or remove a namespace without taking the whole cluster down if you are running server versions prior to 3.13.0.1. We would recommend upgrading to a newer version [1]. However, to avoid downtime, you should be able to change the namespace to data-in-memory and do a rolling restart to claim the space taken by the namespace. You could also make sure the namespace will not be used further by blocking all write requests against it by setting both allow-xdr-writes and allow-nonxdr-writes to false:

  1. Change the configuration of the namespace as such:

  2. Recommended configuration change is as follows:

     namespace ns1 {
         memory-size 1G
         allow-xdr-writes false
         allow-nonxdr-writes false
         storage-engine memory        
     }
    
  3. Perform a rolling restart on your cluster.

  4. At a later time, when you can afford downtime, remove the above from all configs and do a full the cluster shutdown (stop all nodes, then restart all nodes).

Note:

[1] See here for upgrade instructions: http://www.aerospike.com/docs/operations/upgrade/cluster_to_3_13

Timestamp

06/06/2017


Add Namespace: Adding New Namespace
How do I rename an existing namespace in an Aerospike cluster?
What are the steps to remove namespace permanently