Hi Vinay-
Iām glad that you are doing well with Aerospike.
I have numbered my answers to match the numbers of your questions. I didnāt mean to have such lengthy answers, but I wanted to cover all of the questions.
- Can you define a secondary index on a key bin? I have not tried this, but that is because I donāt see the benefit. The index for the key is held in system memory. Secondary indexes are held in process memory. If system memory and process memory both hold the same index value, that would be a redundant use of memory.
In asking this, are you seeking to write the key value in a location where you can retrieve it later?
You might want to either set āsendKeyā in the write policy. You could also simply write the key value to a bin.
The following document discusses these options:
http://www.aerospike.com/docs/client/java/usage/best_practices.html
- Can you evict/expire/delete data in a particular set without impacting the rest of the records in the namespace?
When you write a record to a namespace, the namespace has a ttl (time to live) defined for all records. The configuration for it is ādefault-ttlā. If you do not define a ttl in the client application, the default-ttl is applied to the record. When you update or touch the record, the ttl is reset.
If you set the ttl in the client, that ttl overrides the ttl set on the node. For example, if you define a ttl of 60 in your Java application, and the ttl on the node is 0 (never expire), the record expires in 60 seconds.
The node evicts records when either the high-water-disk-pct or the high-water-memory-pct is breached. The node selects records that are closest to expiration and those records are evicted from the cluster.
(http://www.aerospike.com/docs/operations/configure/namespace/retention/)
The API includes functionality to delete records. The following document discusses deletes in the Java client:
http://www.aerospike.com/docs/client/java/usage/kvs/delete.html
To (finally) answer your question: If you insert all records in a set with the same ttl (set in the client), and their ttls were never reset, they should all expire at about the same time.
If the nodes start evicting, that is an indicator of larger problems.
If you can identify the records for this set in the client, you should be able to delete them there.
- Do you need to mention the same list of namespaces in each node of the cluster?
Yes, absolutely. If you have two nodes, and node_1 has the namespaces test and bar, and the node_2 only has the namespace test, the nodes will not form a cluster.
- The following documentation is for the Java client:
http://www.aerospike.com/docs/client/java/
Scans in the Java client:
http://www.aerospike.com/docs/client/java/usage/scan/scan.html
Write a record in the Java client:
http://www.aerospike.com/docs/client/java/usage/kvs/write.html
Read a record in the Java client:
http://www.aerospike.com/docs/client/java/usage/kvs/read.html