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
数据没有丢失!