hbase数据无法用phoenix查出
前置:hbase数据利用hbase org.apache.hadoop.hbase.mapreduce.Export “asset_list” /user/hbase/asset_list_backup导出后,再利用hbase org.apache.hadoop.hbase.mapreduce.Driver import asset_list /user/hbase/asset_list_back
前置:hbase数据利用hbase org.apache.hadoop.hbase.mapreduce.Export “asset_list” /user/hbase/asset_list_backup导出后,再利用hbase org.apache.hadoop.hbase.mapreduce.Driver import asset_list /user/hbase/asset_list_backup.且导入phoenix中已有对应表以及对应本地索引.
现象:建表完成后,利用hbase shell后,scan或count可以查到数据,但无法通过phoenix进行查询,select count(*) 或select * 返回结果均为0或空.单查select ROW 可返回值(这是最大的特征)
分析:既然数据存在,并且可以通过hbase shell查询.是否是因为phoenix与hbase的映射错误,导致无法通过phoenix进行查询.考虑删除phoenix映射后重建
步骤:
0.desc “xxx”,获得相关表信息,例如
vul_list, {TABLE_ATTRIBUTES => {coprocessor$1 => '|org.apache.phoenix.coprocessor.ScanRegionObserver|805306366|', coprocessor$2 => '|org.apache.phoenix.coprocessor.UngroupedAggr
egateRegionObserver|805306366|', coprocessor$3 => '|org.apache.phoenix.coprocessor.GroupedAggregateRegionObserver|805306366|', coprocessor$4 => '|org.apache.phoenix.coprocessor.
ServerCachingEndpointImpl|805306366|', coprocessor$5 => '|org.apache.phoenix.hbase.index.Indexer|805306366|org.apache.hadoop.hbase.index.codec.class=org.apache.phoenix.index.Pho
enixIndexCodec,index.builder=org.apache.phoenix.index.PhoenixIndexBuilder', coprocessor$6 => '|org.apache.hadoop.hbase.regionserver.IndexHalfStoreFileReaderGenerator|805306366|'
, METADATA => {'DATA_TABLE_NAME' => 'vul_list', 'SPLIT_POLICY' => 'org.apache.phoenix.hbase.index.IndexRegionSplitPolicy'}}
COLUMN FAMILIES DESCRIPTION
{NAME => 'L#0', BLOOMFILTER => 'NONE', VERSIONS => '1', IN_MEMORY => 'false', KEEP_DELETED_CELLS => 'FALSE', DATA_BLOCK_ENCODING => 'FAST_DIFF', TTL => 'FOREVER', COMPRESSION =>
'NONE', MIN_VERSIONS => '0', BLOCKCACHE => 'true', BLOCKSIZE => '65536', REPLICATION_SCOPE => '0'}
{NAME => 't', BLOOMFILTER => 'ROW', VERSIONS => '1', IN_MEMORY => 'false', KEEP_DELETED_CELLS => 'FALSE', DATA_BLOCK_ENCODING => 'NONE', TTL => 'FOREVER', COMPRESSION => 'NONE',
MIN_VERSIONS => '0', BLOCKCACHE => 'true', BLOCKSIZE => '65536', REPLICATION_SCOPE => '0'}
2 row(s) in 0.3390 seconds
存在coprocessor,与phoenix相关,以及列族L#0,与本地索引有关,需要删除
1.利用hbase shell 禁用相关表;命令:disable “xxxx”
2.删除与phoenix有关的coprocessor
alter 'vul_list',METHOD=>'table_att_unset',NAME=>'coprocessor$1'
alter 'vul_list',METHOD=>'table_att_unset',NAME=>'coprocessor$2'
alter 'vul_list',METHOD=>'table_att_unset',NAME=>'coprocessor$3'
alter 'vul_list',METHOD=>'table_att_unset',NAME=>'coprocessor$4'
alter 'vul_list',METHOD=>'table_att_unset',NAME=>'coprocessor$5'
3.删除与phoenix二级本地索引的有关的列族(没有就不删)
alter "vul_list",{NAME => 'L#t',METHOD => 'delete'}
4.通过!tables查看是否存在对应索引表,如果有一并删除.
5.通过phoenix删除表信息
DELETE from SYSTEM.CATALOG where TABLE_NAME =‘IDX_ASSET_ALARM_SUS1’;
6.重启Hbase服务
7.启用相关表
enable “vul_list”
8.重新通过phoenix建表建索引
结果:
数据可正常查询.索引顺利建立
更多推荐
所有评论(0)