在Hive中注册Hbase表

时间:2014-11-21 09:45:36

标签: hadoop hive hbase

我正在使用Hortonworks Sandbox 2.1。此版本包含Hbase和Hive。 为了将我的hbase表注册到配置单元:我使用了这个链接: https://cwiki.apache.org/confluence/display/Hive/HBaseIntegration

'CREATE TABLE IF NOT EXISTS Test_Hive (key int, valuer string) STORED BY ‘org.apache.hadoop.hive.hbase.HBaseStorageHandler’ WITH SERDEPROPERTIES (‘hbase.columns.mapping’ = ‘:key,cf1:val’) TBLPROPERTIES (‘hbase.table.name’ = ‘table_test’);'

但是我有这个错误:

'Execution Error, return code 1 from org.apache.hadoop.hive.q1.exec.DDLtask. org.apache.hadoop.hive.q1.metadata.HiveException : Error in Loading storage handler.org.apashe.hadoop.hive.hbase.HbaseStorageHandler'

我在此链接中找到了: Integrating Hbase with Hive: Register Hbase table

我应该从Hbase复制所有的罐子并且开始使用hive。并且将hbase和hadoop配置为/ etc / Hive / conf /喜欢这个:

'cp -n /usr/lib/hbase/lib/*.jar /usr/lib/hive/lib/ 
 cp -n /usr/lib/hadoop/lib/*.jar /usr/lib/hive/lib/
 cp -n /usr/lib/hbase/conf/* /usr/lib/hive/conf/
 cp -n /usr/lib/hadoop/conf/* /usr/lib/hive/conf/'

但它仍然无法正常工作!!!! 然后我尝试了另一种解决方案(也见于上面的链接): "或者 而不是通过将/或/ us / lib / h / lib / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / "

所以我编辑了我的" /hive-env.sh"文件来改变HIVE_AUX_JARS_PATH,如下所示:

'export HIVE_AUX_JARS_PATH= /usr/lib/hbase/lib'

它还没有用!! 你能告诉我如何解决这个问题吗? 先感谢您。

1 个答案:

答案 0 :(得分:0)

sudo cp /usr/lib/hive/lib/hive-common-0.7.0-cdh3u0.jar  /usr/lib/hadoop/lib/
sudo cp /usr/lib/hive/lib/hbase-0.90.1-cdh3u0.jar  /usr/lib/hadoop/lib/

2)使用以下方式关闭HBASE和HADOOP

/usr/lib/hadoop/bin/stop-all.sh
/usr/lib/hbase/bin/stop-hbase.sh

3)使用COMMOND重新启动HBASE和HADOOP

 /usr/lib/hadoop/bin/start-all.sh
/usr/lib/hadoop/bin/start-hbase.sh