Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to delete whole set from Aerospike namespace?

Tags:

aerospike

Is there any way to delete a set from namespace (Aerospike) from aql or CLI ???

My set also contains Ldts .

Please suggest me a way to delete whole Set from LDT

like image 340
E V S S Harsha Avatar asked Feb 06 '15 12:02

E V S S Harsha


3 Answers

You can delete a set by using

asinfo -v "set-config:context=namespace;id=namespace_name;set=set_name;set-delete=true;"

This link explains more about how the set is deleted

http://www.aerospike.com/docs/operations/manage/sets/#deleting-a-set-in-a-namespace

like image 125
Anshu Prateek Avatar answered Nov 04 '22 13:11

Anshu Prateek


There is a new and better way to do this as of Aerospike Server version 3.12.0, released in March 2017:

asinfo -v "truncate:namespace=namespace_name;set=set_name"

This previous command has been DEPRECATED, and works only up to Aerospike 3.12.1, released in April 2017:

asinfo -v "set-config:context=namespace;id=namespace_name;set=set_name;set-delete=true;"

The new command is better in several ways:

  • Can be issued during migrations
  • Can be issued while data is being written to the set
  • It is sufficient to run it on just one node of the cluster

I used it under those conditions (during migration, while data was being written, on 1 node) and it ran very quickly. A set with 30 million records was reduced to 1000 records in about 6 seconds. (Those 1000 records were presumably the ones written during those 6 seconds)

Details here

like image 4
Sampras Avatar answered Nov 04 '22 12:11

Sampras


As of Aerospike 3.12, which was released in March 2017, the feature of deleting all data in a set or namespace is now supported in the database.

Please see the following documentation: http://www.aerospike.com/docs/reference/info#truncate

Which provides the command line command that looks like: asinfo truncate:namespace=;set=;lut=

It can also be truncated from the client APIs, here is the java documentation: http://www.aerospike.com/apidocs/java/com/aerospike/client/AerospikeClient.html and scroll down to the "truncate" method.

Please note that this feature can, optionally, take a time specification. This allows you to delete records, then start inserting new records. As timestamps are used, please make certain your server clocks are well synchronized.

like image 3
Brian Bulkowski Avatar answered Nov 04 '22 11:11

Brian Bulkowski