日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

hive与hbase集成

發(fā)布時間:2023/12/13 编程问答 39 豆豆
生活随笔 收集整理的這篇文章主要介紹了 hive与hbase集成 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

環(huán)境:

hadoop2.7.7

hive3.1.0

hbase2.0.2

1.jar包拷貝(之所以用這種方式,是因為這種方式最為穩(wěn)妥,最開始用的軟連接的方式,總是卻少jar包)到hive的lib目錄下刪除所有hbase相關(guān)的jar

rm -rf hbase-*.jar

接著從hbase的lib目錄下拷貝所有的hbase相關(guān)jar

cp -a? hbasehome/lib/hbase-*.jar ./

zookeeper相關(guān)的jar也要進(jìn)行替換

2.在hive的hive-site.xml中添加zk的相關(guān)配置

1 <property> 2 <name>hive.zookeeper.quorum</name> 3 <value>hadoop002,hadoop003,hadoop004</value> 4 <description>The list of ZooKeeper servers to talk to. This is only needed for read/write locks.</description> 5 </property> 6 <property> 7 <name>hive.zookeeper.client.port</name> 8 <value>2181</value> 9 <description>The port of ZooKeeper servers to talk to. This is only needed for read/write locks.</description> 10 </property>

3.在hive中創(chuàng)建表,執(zhí)行完建表語句后,會在hbase生成對應(yīng)的hbase_emp_table表,但是這種表是non-native table類型的表,無法被truncate,也無法使用load加載數(shù)據(jù)

1 CREATE TABLE hive_hbase_emp_table( 2 empno int, 3 ename string, 4 job string, 5 mgr int, 6 hiredate string, 7 sal double, 8 comm double, 9 deptno int) 10 STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' 11 WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,info:ename,info:job,info:mgr,info:hiredate,info:sal,info:comm,info:deptno") 12 TBLPROPERTIES ("hbase.table.name" = "hbase_emp_table");

4.插入數(shù)據(jù)

上面說了無法通過load加載數(shù)據(jù),所以借助臨時表進(jìn)行insert,已提前創(chuàng)建了emp表.并插入了數(shù)據(jù)

empno對應(yīng)hbase_emp_table的行鍵,不能為null

insert into table hive_hbase_emp_table select * from emp where empno is not null;

5.之后分別在hive和hbase查詢數(shù)據(jù)即可

6.無法創(chuàng)建新的管理表與hbase_emp_table關(guān)聯(lián),只能通過創(chuàng)建外部表的方式與hbase_emp_table進(jìn)行關(guān)聯(lián)

轉(zhuǎn)載于:https://www.cnblogs.com/tele-share/p/9984903.html

總結(jié)

以上是生活随笔為你收集整理的hive与hbase集成的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。