1. 安装运行hadoop
2. 安装运行hbase
3. 下载hive
4. 配置(关于集成hbase的部分):
<property>
<name>hive.aux.jars.path</name>
<value>file:///home/zcwangjb/nutch/apache-hive-0.13.1-bin/lib/hive-hbase-handler-0.13.1.jar,file:///home/zcwangjb/nutch/apache-hive-0.13.1-bin/lib/zookeeper-3.4.5.jar,file:///home/zcwangjb/nutch/apache-hive-0.13.1-bin/lib/hbase-0.94.20.jar</value>
</property>
5. 拷贝jar
hive/lib下没有hbase的jar,将hbase下的hbase-0.94.20.jar(同上面配置文件中的版本)拷贝到hive/lib下
5. 运行
./bin/hive -hiveconf hbase.master=127.0.0.1:60000
6. 测试
在hive下 建立表:
CREATE TABLE hbase_hive(key string, value string)STORED BY'org.apache.hadoop.hive.hbase.HBaseStorageHandler'WITH SERDEPROPERTIES("hbase.columns.mapping"=":key,info:value")TBLPROPERTIES ("hbase.table.name"= "hbase_hive");
查询:
hive> show tables; OK a hbase_hive mytest1 pokes Time taken: 0.05 seconds, Fetched: 4 row(s) |
在hbase shell中查询:
hbase(main):011:0* list TABLE hbase_hive 1 row(s) in 0.0460 seconds |
说明集成成功。