Quantcast
Channel: TTL for Hbase Tables works on Column Qualifier and does not delete updated Columns - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Answer by Shu for TTL for Hbase Tables works on Column Qualifier and does not delete updated Columns

$
0
0

If you define TTL on columnfamily level while creating table

(or)

By using alter command, then we are able to delete entire row from HBase.

Example:

1. Creating table with TTL:

hbase(main):> create 'ttl_tbl', {'NAME' => 'cf','TTL' => 20} //all rows will expire after 20 secs
hbase(main):> put 'ttl_tbl','row1','cf:desc', 'TTL shu'
hbase(main):> put 'ttl_tbl','row1','cf:desc1', 'TTL shu'
hbase(main):> scan 'ttl_tbl'
ROW                                                    COLUMN+CELL
 row1                                                  column=cf:desc, timestamp=1562101913869, value=TTL shu
 row1                                                  column=cf:desc1, timestamp=1562101914445, value=TTL shu

After 20 secs:

hbase(main):009:0> scan 'ttl_tbl'
ROW                                                    COLUMN+CELL
0 row(s)

2. Creating table without TTL:

hbase(main):010:0> create 'ttl_tbl1','cf'
hbase(main):011:0> put 'ttl_tbl1','row1','cf:desc','TTL shu',{TTL => 10000} //this row will be deleted after 10 sec as TTL on qualifier is in milliseconds

hbase(main):012:0> put 'ttl_tbl','row1','cf:desc1', 'TTL shu' //no ttl will not be deleted.

Viewing all articles
Browse latest Browse all 2

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>