HBase修改表TTL值
1.创建测试表
hbase(main):010:0> create 'DCP_TEST',{NAME => 'info',VERSIONS => 1, TTL => 214783647, BLOCKCACHE => false,IN_MEMORY=>false},{NAME=>'tempData',VERSIONS=>1,TTL=>259200,BLOCKCACHE=>false,IN_MEMORY=>false}
0 row(s) in 0.6210 seconds
2.查看表结构
hbase(main):011:0> describe 'DCP_TEST' DESCRIPTION ENABLED
{NAME => 'DCP_TEST', FAMILIES => [
{NAME => 'info', BLOOMFILTER => 'NONE', REPLICATION_SCOPE => '0', COMPRESSION = true
> 'NONE', VERSIONS => '1',
TTL => '214783647', BLOCKSIZE => '65536', IN_MEMORY => 'false', BLOCKCACHE => 'false'},
{NAME => 'tempData', BLOOMFILTER => 'NONE', REPLICATION_SCOPE => '0', COMPRESSION => 'NONE', VERSIONS => '1',
TTL => '259200', BLOCKSIZE => '65536', IN_MEMORY => 'false', BLOCKCACHE => 'false'}]}
1 row(s) in 0.0810 seconds
3.往两个column family中插入一列数据
hbase(main):031:0> put 'DCP_TEST', 'row1', 'info:1', 'value1'
0 row(s) in 0.0530 seconds
hbase(main):038:0> put 'DCP_TEST', 'row1', 'tempData:1', 'value1'
0 row(s) in 0.0610 seconds
4.查看表中的数据
hbase(main):039:0> scan 'DCP_TEST'
ROW COLUMN+CELL
row1 column=info:1, timestamp=1354604240975, value=value1
row1 column=tempData:1, timestamp=1354605812128, value=value1
1 row(s) in 0.0310 seconds
5.修改column Family : tempData的TTL
hbase(main):033:0> disable 'DCP_TEST'
0 row(s) in 11.5660 seconds
hbase(main):034:0> alter 'DCP_TEST' , {NAME=>'tempData',TTL=>'600000'}
0 row(s) in 0.1260 seconds
hbase(main):035:0> enable 'DCP_TEST'
0 row(s) in 1.5400 seconds
6. 验证表结构
hbase(main):036:0> describe 'DCP_TEST'
DESCRIPTION ENABLED
{NAME => 'DCP_TEST', FAMILIES => [{NAME => 'info', BLOOMFILTER => 'NONE', REPLICATION_SCOPE => '0', COMPRESSION = true
> 'NONE', VERSIONS => '1', TTL => '214783647', BLOCKSIZE => '65536', IN_MEMORY => 'false', BLOCKCACHE => 'false'}
, {NAME => 'tempData', BLOOMFILTER => 'NONE', REPLICATION_SCOPE => '0', COMPRESSION => 'NONE', VERSIONS => '1', T
TL => '600000', BLOCKSIZE => '65536', IN_MEMORY => 'false', BLOCKCACHE => 'false'}]}
1 row(s) in 0.0720 seconds
7.验证表中的数据
hbase(main):044:0> scan 'DCP_TEST'
ROW COLUMN+CELL
row1 column=info:1, timestamp=1354604240975, value=value1
row1 column=tempData:1, timestamp=1354605812128, value=value1
1 row(s) in 0.0370 seconds
数据没有丢失!
推荐阅读
-
Win10快速访问怎么关闭?Win10修改注册表值关闭的方法的方法
-
荐 2.3 数据库表结构的创建和修改|数据库索引、默认值、计算列|聚集索引、非聚集索引
-
如何修改注册表二进制值将Win11任务栏移动到顶部
-
SQLServer之修改表值函数
-
读者来信 | 设置HBase TTL必须先disable表吗?(已解决)
-
通过注册表修改dpi值实现PPT直接导出高分辨率图片
-
WindowsXP注册表进入方法及修改注册表相关值来优化电脑
-
[Mysql]一张1000W条记录的表中,修改表结构,为一个enum字段增加一个值,需要多久时间?
-
java正则表达式判断前端参数修改表中另一个字段的值
-
mysql 数据导出修改表结构后,再导入,新添加的字段插入默认值