Time To Live (TTL)

Category : Hadoop | Sub Category : Apache HBase | By Runner Dev Last updated: 2021-01-05 08:56:56 Viewed : 159

ColumnFamilies can set a TTL length in seconds, and HBase will automatically delete rows once the expiration time is reached. This applies to all versions of a row - even the current one. The TTL time encoded in the HBase for the row is specified in UTC.

Store files which contains only expired rows are deleted on minor compaction. Setting hbase.store.delete.expired.storefile to false disables this feature. Setting minimum number of versions to other than 0 also disables this.

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.

    Change the Value of KEEP_DELETED_CELLS Using HBase Shell
    hbase> hbase> alter t1, NAME => f1, KEEP_DELETED_CELLS => true

Related Articles

Leave a Comment: