1200px-Apache_Hive_logo.svg.png在
hdp
平台上,使用hive控制台创建一个hbase的外部表,出现ERROR : FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. MetaException(message:org.apache.hadoop.hbase.TableNotFoundException
,原因是启动了Ranger
认证,hive用户需要有hbase的创建权限才可以。
解决方法
为hive用户添加权限
image.png
Hbase创建表语句如下
create 'test','ext'
put 'test','r1','ext:userId','abc'
hive创建外部表
create external table abc(rowkey string,userId string) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES("hbase.columns.mapping" = ":key,ext:userId") TBLPROPERTIES("hbase.table.name" = "test");
显示成功结果如下
INFO : Compiling command(queryId=hive_20181201020808_28788898-f5a0-4316-84c6-dce6b8cff2f6): create external table abc(rowkey string,userId string) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES("hbase.columns.mapping" = ":key,ext:userId") TBLPROPERTIES("hbase.table.name" = "test")
INFO : Semantic Analysis Completed (retrial = false)
INFO : Returning Hive schema: Schema(fieldSchemas:null, properties:null)
INFO : Completed compiling command(queryId=hive_20181201020808_28788898-f5a0-4316-84c6-dce6b8cff2f6); Time taken: 0.035 seconds
INFO : Executing command(queryId=hive_20181201020808_28788898-f5a0-4316-84c6-dce6b8cff2f6): create external table abc(rowkey string,userId string) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES("hbase.columns.mapping" = ":key,ext:userId") TBLPROPERTIES("hbase.table.name" = "test")
INFO : Starting task [Stage-0:DDL] in serial mode
INFO : Completed executing command(queryId=hive_20181201020808_28788898-f5a0-4316-84c6-dce6b8cff2f6); Time taken: 0.888 seconds
INFO : OK
No rows affected (1.581 seconds)
网友评论