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

歡迎訪問 生活随笔!

生活随笔

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

编程问答

springboot+hbase 集成

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

項(xiàng)目中使用 phoenix 使用SQL 方式來操作Hbase 數(shù)據(jù)庫,但是遇到一個(gè)是,SQL在Dbeaver 中查詢速度還可以,但是使用phoenix+ibatis 后返回結(jié)果集數(shù)據(jù)量20w ,速度特別慢,先是考慮用redis方式緩存,但是內(nèi)存有限,想著是用,hbase直連的方式,測試一下解決一下,

一:簡介
hbase-client是HBase提供的一套比較底層的API,在實(shí)際使用時(shí)需要對(duì)其進(jìn)行封裝,提供更好用的api給用戶。

操作hbase的客戶端有以下幾種方式:

hbase-client 比較底層,需要自己進(jìn)一步封裝api,而且版本號(hào)和安裝的hbase也要匹配,否則會(huì)報(bào)錯(cuò)
spring-data-hadoop 2019年4月5停止維護(hù)
Apache Phoenix 使用SQL的方式來操作HBase

  • 下面是springboot+ hbase-client方式

注意!需要去掉slf4j和log4j jar 否則會(huì)報(bào)相應(yīng)的錯(cuò)誤:pom.xml 引入

<dependency><groupId>org.apache.hbase</groupId><artifactId>hbase-client</artifactId><version>2.1.3</version><exclusions><exclusion><groupId>org.slf4j</groupId><artifactId>slf4j-log4j12</artifactId></exclusion><exclusion><groupId>log4j</groupId><artifactId>log4j</artifactId></exclusion></exclusions></dependency>

注意!hbase application.yml 設(shè)置:?hbase.zookeeper.znode 更正為hbase.zookeeper.parent

hbase:config:hbase.zookeeper.quorum: 127.0.0.1hbase.zookeeper.port: 2181hbase.zookeeper.parent: /hbasehbase.client.keyvalue.maxsize: 1572864000

hbase.zookeeper.parent的作用:

Zookeeper作用在于:

1、hbase regionserver向zookeeper注冊(cè),提供hbase regionserver狀態(tài)信息(是否在線)。

2、hmaster啟動(dòng)時(shí)候會(huì)將hbase系統(tǒng)表-ROOT-加載到zookeeper cluster,通過zookeeper cluster可以獲取當(dāng)前系統(tǒng)表.META.的存儲(chǔ)所對(duì)應(yīng)的regionserver信息。

zookeeper是hbase集群的"協(xié)調(diào)器"。由于zookeeper的輕量級(jí)特性,因此我們可以將多個(gè)hbase集群共用一個(gè)zookeeper集群,以節(jié)約大量的服務(wù)器。多個(gè)hbase集群共用zookeeper集群的方法是使用同一組ip,修改不同hbase集群的"zookeeper.znode.parent"屬性,讓它們使用不同的根目錄。比如cluster1使用/hbase-c1,cluster2使用/hbase-c2,等等。

HMaster主要作用在于,通過HMaster維護(hù)系統(tǒng)表-ROOT-,.META.,記錄regionserver所對(duì)應(yīng)region變化信息。此外還負(fù)責(zé)監(jiān)控處理當(dāng)前hbase cluster中regionserver狀態(tài)變化信息。

hbase regionserver則用于多個(gè)/單個(gè)維護(hù)region。

region則對(duì)應(yīng)為hbase數(shù)據(jù)表的表分區(qū)數(shù)據(jù)維護(hù)。

參考:https://www.cnblogs.com/cxzdy/p/5369187.html

https://www.jianshu.com/p/67a817a157ee

項(xiàng)目搭建參考如下:

https://blog.csdn.net/vbirdbest/article/details/88410954

3. hbase API 建議參考:

https://www.cnblogs.com/frankdeng/p/9310209.html

4.hbase 基本的JavaApi 數(shù)據(jù)操作及數(shù)據(jù)過濾(filter)

https://www.cnblogs.com/frankdeng/p/9310262.html

https://www.cnblogs.com/asker009/p/10626508.html

?

總結(jié)

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

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