为什么ttl-forhbase表在列限定符上工作,并且在以后更新某些限定符时不删除整行。它只删除超出ttl的列限定符。这是期望的行为吗?对于这种情况,如何删除完整的行?
np8igboo1#
如果定义ttl on columnfamily 创建表时的级别 (or) 通过使用 alter 命令,则可以从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 shuAfter 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
columnfamily
(or)
alter
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):012:0> put 'ttl_tbl','row1','cf:desc1', 'TTL shu' //no ttl will not be deleted.
1条答案
按热度按时间np8igboo1#
如果定义ttl on
columnfamily
创建表时的级别(or)
通过使用alter
命令,则可以从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.