HBase集群环境安装
>>>hive与hbase集成(https://cwiki.apache.org/confluence/display/Hive/HBaseIntegration)
hive/lib/ hbase/lib
1.查看guava-12.0.1.jar 版本是否相同,不同则删掉一个,然后拷贝,保持版本一致。
2.添加软连接(以下几个jar包可能不全,可根据实际操作时报的错进行补充)
ln -s /opt/hbase/lib/hbase-common-0.98.6-cdh5.3.6.jar /opt/hive/lib/hbase-common-0.98.6-cdh5.3.6.jar
ln -s /opt/hbase/lib/hbase-server-0.98.6-cdh5.3.6.jar /opt/hive/lib/hbase-server-0.98.6-cdh5.3.6.jar
ln -s /opt/hbase/lib/hbase-client-0.98.6-cdh5.3.6.jar /opt/hive/lib/hbase-client-0.98.6-cdh5.3.6.jar
ln -s /opt/hbase/lib/hbase-protocol-0.98.6-cdh5.3.6.jar /opt/hive/lib/hbase-protocol-0.98.6-cdh5.3.6.jar
ln -s /opt/hbase/lib/hbase-it-0.98.6-cdh5.3.6.jar /opt/hive/lib/hbase-it-0.98.6-cdh5.3.6.jar
ln -s /opt/hbase/lib/htrace-core-2.04.jar /opt/hive/lib/htrace-core-2.04.jar
3.vi hive-site.xml 添加:
<property>
<name>hbase.zookeeper.quorum</name>
<value>master,slave1,slave2</value>
</property>
4. 创建hbase识别的表:
hive> CREATE TABLE hbase_table_1(key int, value string)
> STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
> WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,cf1:val")
> TBLPROPERTIES ("hbase.table.name" = "xyz");