Support Questions

Find answers, ask questions, and share your expertise

How to configure per Cell TTL on HBase

avatar
Explorer

Hello,

We have a need to configure a Cell ttl due to a demand from the dev team. They say they can't create another CF for that. Do we have support for it?

I found the follow on Jira:

https://issues.apache.org/jira/browse/HBASE-10560

2 REPLIES 2

avatar
@Luiz Fernando Lacerda Prina

As per the jira it should be configurable. Please refer below from hbase official doc.

""Recent versions of HBase also support setting time to live on a per cell basis. See HBASE-10560 for more information. Cell TTLs are submitted as an attribute on mutation requests (Appends, Increments, Puts, etc.) using Mutation#setTTL. If the TTL attribute is set, it will be applied to all cells updated on the server by the operation. There are two notable differences between cell TTL handling and ColumnFamily TTLs:

  • Cell TTLs are expressed in units of milliseconds instead of seconds.
  • A cell TTLs cannot extend the effective lifetime of a cell beyond a ColumnFamily level TTL setting."""

avatar
New Contributor

How do I set TTL for a cell versus a Column Family(CF)?
When I do the following, it is applying TTL to the CF.

put.addColumn("cf",columnname,columndata).setTTL(1000);//1 minute