Aerospike expired data

How do i get expired data ??

Could you elaborate on the question. Is the question about recovering expired data? or setting expiration on existing data?

Data that have expired are no longer indexed in the database and will not be retrievable. That said, if you are using persistent storage, and you desperately need to recover data that were accidentally set to the wrong expiration TTL and have already expired, you may be able to change the time on your server to a time and date prior to that expiration and do a cold-start to re-index data from disk.

A few caveats with this approach would be that you could only recover objects that have not been overwritten. The server time would need to be changed on the entire cluster and also No client should be hitting that cluster to prevent new writes or update to occur during this maintenance.

Here is some additional iinfo on Expirations:

the question about recovering expired data

In aerospike.conf file one of my namespace ttl given as 30 seconds,after 30s data was expired so how to get that data,please provide a solution

If your data expired due to reaching a TTL, you can’t get it back. That’s the purpose of a per-record TTL value - you’re telling the database that after a certain amount of time you want to have that data cleaned up, and the namespace supervisor thread did that task.

Similar to @rbotzer’s answer, there isn’t a good way to recover this data and if you are still writing much of it may be irrecoverable now.

I can think of 2 methods, for either you will want to stop the write load to these servers ASAP to prevent further data loss.

Solution 1:

  1. Stop aerospike
  2. Disable NTP
  3. Set the server’s time back to a day before the data loss began.
  4. Coldstart the server.

This will bring back whatever data remains on the disk. You will then want to scan all the data and update the TTL to your desired value and write the record back. Afterwards stop the server again, re-enable NTP, ensure the time returns to the correct time, and start the server again.

Solution 2:

  1. Modify Aerospike’s code to never expire any record.
  2. Compile the new code.
  3. Start the modified version.

Again, this will bring back whatever data remains on the disk. You will then want to scan all the data and update the TTL to your desired value and write the record back. Afterwards stop the server again, restore the official aerospike binary and start the server.