我指的是Hive-HBase 集成。
首先,我验证了 HBase 中没有名为 ORDERS_HIVE_DUMMY 的表:
hbase(main):016:0> describe 'ORDERS_HIVE_DUMMY'
ERROR: Failed to find table named ORDERS_HIVE_DUMMY
Here is some help for this command:
Describe the named table. For example:
hbase> describe 't1'
然后我启动了蜂巢外壳:
hduser@cldx-1139-1033:~/hadoop_ecosystem/apache_hive/hive_installation/hive-0.9.0/bin$ ./hive --auxpath $HIVE_HOME/lib/hive-hbase-handler-0.9.0.jar,$HBASE_HOME/hbase-0.94.6.1.jar,$HBASE_HOME/lib/zookeeper-3.4.5.jar,$HIVE_HOME/lib/guava-r09.jar -hiveconf hbase.zookeeper.quorum=cldx-1140-1034
WARNING: org.apache.hadoop.metrics.jvm.EventCounter is deprecated. Please use org.apache.hadoop.log.metrics.EventCounter in all the log4j.properties files.
Logging initialized using configuration in jar:file:/home/hduser/hadoop_ecosystem/apache_hive/hive_installation/hive-0.9.0/lib/hive-common-0.9.0.jar!/hive-log4j.properties
Hive history file=/tmp/hduser/hive_job_log_hduser_201304192016_1559705029.txt
hive>
然后,我创建了一个表
hive> CREATE TABLE ORDERS_HIVE_DUMMY(ORDER_ID STRING,CUSTOMER_ID STRING,PRODUCT_ID STRING,ORDER_DATE TIMESTAMP,QUANTITY DOUBLE,AMOUNT DOUBLE,PAYMENT_MODE STRING) STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,ORDER_DETAILS:CUSTOMER_ID,ORDER_DETAILS:PRODUCT_ID,ORDER_DETAILS:REQUEST_DATE,ORDER_DETAILS:PRODUCT_QUANTITY,ORDER_DETAILS:PRICE,ORDER_DETAILS:PAYMENT_MODE");
OK
Time taken: 11.893 seconds
然后,我验证了该表是在 HBase 中创建的
hbase(main):017:0> describe 'ORDERS_HIVE_DUMMY'
DESCRIPTION ENABLED
{NAME => 'ORDERS_HIVE_DUMMY', FAMILIES => [{NAME => 'ORDER_DETAILS', BLOOMFILTER true
=> 'NONE', REPLICATION_SCOPE => '0', VERSIONS => '3', COMPRESSION => 'NONE', MI
N_VERSIONS => '0', TTL => '2147483647', BLOCKSIZE => '65536', IN_MEMORY => 'fals
e', BLOCKCACHE => 'true'}]}
但是现在当我在 Hive 上查询表时,我得到了一个异常:
hive> select * from ORDERS_HIVE_DUMMY;
OK
Failed with exception java.io.IOException:org.apache.hadoop.hbase.TableNotFoundException: orders_hive_dummy
Time taken: 0.455 seconds
我猜想查询外部表需要一些提示写在 HIve 提示符上的查询?可能是什么错误?