hive与hbase整合

来源:互联网 发布:sql2005数据库安装教程 编辑:程序博客网 时间:2024/05/14 20:55

参考博客:http://blog.csdn.net/daniel_ustc/article/details/12795627

在第二步编辑hive-site.xml的时候可以加入

<property><name>hive.zookeeper.quorum</name><value>host01,host02,host03</value></property>

这样启动时就不需要另外加参数了

创建hive的外部表以关联hbase:

CREATE EXTERNAL TABLE hbase_table_1(key string, value string)     STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'     WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,columnfamily:col1")     TBLPROPERTIES("hbase.table.name" = "hbase_test");   

另外可以在创建hive表的时候直接创建hbase的关联表

CREATE TABLE test_hbase(key int, value string)  STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'  WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,cf1:val")  TBLPROPERTIES ("hbase.table.name" = "test_hive");   




0 0
原创粉丝点击