hive导数据到hbase

hbase0.98,hive1.2


一,copy hbase/lib/hbase-client-0.98.1-cdh5.1.0.jar
hbase-server-0.98.1-cdh5.1.0.jar
hbase-common-0.98.1-cdh5.1.0.jar
hbase-protocol-0.98.1-cdh5.1.0.jar
htrace-core-2.04.jar 

到hive/lib

二,以下方式启动hive:

 bin/hive --auxpath ./lib/hive-hbase-handler-0.12.0-cdh5.1.0.jar, ./lib/hbase-server-0.98.1-cdh5.1.0.jar , ./lib/zookeeper-3.4.5-cdh5.1.0.jar , ./lib/guava-11.0.2.jar  --hiveconf hbase.zookeeper.quorum=192.168.1.4,192.168.1.3,192.168.1.5


三,创建关联表:

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


四,将hive的数据导入到hbase:

     insert into table x2 select (a + a) as key,b from hive_test


你可能感兴趣的:(hbase)