HBase清空表数据

一、清除之前检查

1.表的region分配情况;

2.表的大小(grafana可以看到);

二、清除之前备份

hbase(main):001:0> disable 'gx_rpt:msg_push_taskid_group_name'
0 row(s) in 2.1140 seconds

hbase(main):002:0> snapshot 'gx_rpt:msg_push_taskid_group_name','gx_rpt.msg_push_taskid_group_name_20171115'
0 row(s) in 1.2060 seconds

hbase(main):004:0> list_snapshots
SNAPSHOT TABLE + CREATION TIME
gx_rpt.msg_push_taskid_group_name gx_rpt:msg_push_taskid_group_name_20171115  (Wed Nov 15 16:24:47 +0800 2017)
 

三、清空表数据

有两个命令可选:

hbase(main):003:0> help 'truncate'
Disables, drops and recreates the specified table.
hbase(main):004:0> help 'truncate_preserve'
Disables, drops and recreates the specified table while still maintaing the previous region boundaries.

选择truncate_preserve

hbase(main):008:0> truncate_preserve 'gx_rpt:msg_push_taskid_group_name'

Truncating 'gx_rpt:msg_push_taskid_group_name' table (it may take a while):
- Disabling table...
- Truncating table...
0 row(s) in 7.5620 seconds

hbase(main):009:0> describe 'gx_rpt:msg_push_taskid_group_name'
Table gx_rpt:msg_push_taskid_group_name is ENABLED
gx_rpt:msg_push_taskid_group_name
COLUMN FAMILIES DESCRIPTION
{NAME => 'inf', DATA_BLOCK_ENCODING => 'NONE', BLOOMFILTER => 'ROW', REPLICATION_SCOPE => '0', VERSIONS => '3', COMPRESSION => 'NONE'
, MIN_VERSIONS => '0', TTL => 'FOREVER', KEEP_DELETED_CELLS => 'FALSE', BLOCKSIZE => '65536', IN_MEMORY => 'false', BLOCKCACHE => 'tr
ue'}
1 row(s) in 0.0440 seconds

hbase(main):014:0> count 'gx_rpt:msg_push_taskid_group_name'
0 row(s) in 0.6100 seconds

=> 0

猜你喜欢

转载自blog.csdn.net/mnasd/article/details/81097855