How to query the metadata(such as ttl) of record from tools?

I check Aerospike tools ( AQL and cli), and can not get any command.

These are tools to look at the data and not the metadata. You could use UDF to get this information from record

local function get_metadata(rec)
   return record.ttl(rec);
end

– R

Maybe some day you will add the feature in AQL

You can use AQL in JSON output mode to see such details:

aql>set output json aql>set RECORD_PRINT_METADATA true aql>select * from where PK = ‘423417571’; [ { “digest”: “AAAAAAAAAAAAAAAAAAAAAAAAAAA=”, “ttl”: 344964, “gen”: 180, “bins”: { “”: “Data” } } ]

Note, when using where pk = xxx as in above, the digest reported by AQL is wrong. (AQL bug). also, command should be > aql>select * from <ns>.[<set>] where pk = 'xxx' (namespace and set are missing)