掃二維碼與項目經理溝通
我們在微信上24小時期待你的聲音
解答本文疑問/技術咨詢/運營咨詢/技術建議/互聯網交流
HBase 是一個面向列式存儲的分布式數據庫,其設計思想來源于 Google 的 BigTable 論文。HBase 底層存儲基于 HDFS 實現,集群的管理基于 ZooKeeper 實現。HBase 良好的分布式架構設計為海量數據的快速存儲、隨機訪問提供了可能,基于數據副本機制和分區(qū)機制可以輕松實現在線擴容、縮容和數據容災,是大數據領域中 Key-Value 數據結構存儲最常用的數據庫方案。

創(chuàng)新互聯服務項目包括牡丹網站建設、牡丹網站制作、牡丹網頁制作以及牡丹網絡營銷策劃等。多年來,我們專注于互聯網行業(yè),利用自身積累的技術優(yōu)勢、行業(yè)經驗、深度合作伙伴關系等,向廣大中小型企業(yè)、政府機構等提供互聯網行業(yè)的解決方案,牡丹網站推廣取得了明顯的社會效益與經濟效益。目前,我們服務的客戶以成都為中心已經輻射到牡丹省份的部分城市,未來相信會繼續(xù)擴大服務區(qū)域并繼續(xù)獲得客戶的支持與信任!
地址:https://artifacthub.io/packages/helm/hbase/hbase
helm repo add hbase https://itboy87.github.io/bigdata-charts/
# hbase version 2.4.13
helm pull hbase/hbase --version 0.1.7
在下面連接hadoop高可用會重新構建鏡像,這里就不重新構建鏡像了,只是把遠程的包推送到本地harbor倉庫
docker pull ghcr.io/fleeksoft/hbase/hbase-base:2.4.13.2
# tag
docker tag ghcr.io/fleeksoft/hbase/hbase-base:2.4.13.2 myharbor.com/bigdata/hbase-base:2.4.13.2
# push
docker push myharbor.com/bigdata/hbase-base:2.4.13.2
image:
repository: myharbor.com/bigdata/hbase-base
tag: 2.4.13.2
pullPolicy: IfNotPresent
...
conf:
hadoopUserName: admin
hbaseSite:
hbase.rootdir: "hdfs://hadoop-hadoop-hdfs-nn.hadoop:9000/hbase"
hbase.zookeeper.quorum: "zookeeper.zookeeper:2181"
...
hbase:
master:
replicas: 2
regionServer:
replicas: 2
# 禁用內部的hadoop
hadoop:
enabled: false
# 禁用內部的zookeeper
zookeeper:
enabled: false
if [ ` `.`Values`.`hadoop`.`enabled ` = true ];then
NAMENODE_URL={{- printf "http://%s-hadoop-hdfs-nn:9870/index.html" .Release.Name }}
else
hadoop_url={{ index .Values.conf.hbaseSite "hbase.rootdir" }}
hadoop_url=`echo $hadoop_url|awk -F '/' '{print $3}'|awk -F':' '{print $1}'`
NAMENODE_URL=http://${hadoop_url}:9870/index.html
fi
# 先檢查語法
helm lint ./hbase
# 開始安裝
helm install hbase ./hbase -n hbase --create-namespace
NOTES
NAME: hbase
LAST DEPLOYED: Sat Nov 5 15:44:14 2022
NAMESPACE: hbase
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
1. You can get an HBASE Shell by running this command:
kubectl exec -n hbase -it hbase-hbase-master-0 -- hbase shell
2. Inspect hbase master service ports with:
kubectl exec -n hbase describe service hbase-hbase-master
3. Create a port-forward to the hbase manager UI:
kubectl port-forward -n hbase svc/hbase-hbase-master 16010:16010
Then open the ui in your browser:
open http://localhost:16010
4. Create a port-forward to the hbase thrift manager UI:
kubectl port-forward -n hbase svc/hbase-hbase-master 9095:9095
Then open the ui in your browser:
open http://localhost:9095
HDFS
查看
kubectl get pods,svc -n hbase -owide
測試主備切換,重啟當前active master pod
kubectl delete pod hbase-hbase-master-0 -n hbase
主備能正常切換
helm uninstall hbase -n hbase
# delete ns
kubectl delete ns hbase --force
helm repo add hbase https://itboy87.github.io/bigdata-charts/
# hbase version 2.4.13
helm pull hbase/hbase --version 0.1.7
這里是基于上面的鏡像進行構建,只是把hadoop打包到鏡像中,主要用的hadoop配置文件是core-site.yaml,hdfs-site.yaml
Dockerfile
FROM myharbor.com/bigdata/hbase-base:2.4.13.2
RUN mkdir -p /opt/apache
ENV HADOOP_VERSION=3.3.2
ADD hadoop-${HADOOP_VERSION}.tar.gz /opt/apache
ENV HADOOP_HOME=/opt/apache/hadoop
RUN ln -s /opt/apache/hadoop-${HADOOP_VERSION} $HADOOP_HOME
ENV HADOOP_CONF_DIR=${HADOOP_HOME}/et/hadoop
ENV PATH=${HADOOP_HOME}/bin:$PATH
開始構建
docker build -t myharbor.com/bigdata/hbase-hdfs-ha:2.4.13.2 . --no-cache
### 參數解釋
# -t:指定鏡像名稱
# . :當前目錄Dockerfile
# -f:指定Dockerfile路徑
# --no-cache:不緩存
# 推送到harbor
docker push myharbor.com/bigdata/hbase-hdfs-ha:2.4.13.2
image:
repository: myharbor.com/bigdata/hbase-hdfs-ha
tag: 2.4.13.2
pullPolicy: IfNotPresent
...
conf:
hadoopUserName: admin
hbaseSite:
hbase.rootdir: "hdfs://myhdfs/hbase"
hbase.zookeeper.quorum: "zookeeper.zookeeper:2181"
if [ {{ .Values.hadoop.enabled }} = true ];then
NAMENODE_URL={{- printf "http://%s-hadoop-hdfs-nn:9870/index.html" .Release.Name }}
else
NAMENODE_URL=http://hadoop-ha-hadoop-hdfs-nn-1.hadoop-ha:9870:9870/index.html
fi# 先檢查語法
helm lint ./hbase-hdfs-ha
# 開始安裝
helm install hbase-hdfs-ha ./hbase-hdfs-ha -n hbase-hdfs-ha --create-namespace
NOTES
NAME: hbase-hdfs-ha
LAST DEPLOYED: Sat Nov 5 17:23:20 2022
NAMESPACE: hbase-hdfs-ha
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
1. You can get an HBASE Shell by running this command:
kubectl exec -n hbase-hdfs-ha -it hbase-hdfs-ha-hbase-master-0 -- hbase shell
2. Inspect hbase master service ports with:
kubectl exec -n hbase-hdfs-ha describe service hbase-hdfs-ha-hbase-master
3. Create a port-forward to the hbase manager UI:
kubectl port-forward -n hbase-hdfs-ha svc/hbase-hdfs-ha-hbase-master 16010:16010
Then open the ui in your browser:
open http://localhost:16010
4. Create a port-forward to the hbase thrift manager UI:
kubectl port-forward -n hbase-hdfs-ha svc/hbase-hdfs-ha-hbase-master 9095:9095
Then open the ui in your browser:
open http://localhost:9095
HDFS
查看
kubectl get pods,svc -n hbase-hdfs-ha
測試主備切換,重啟當前active master pod
kubectl delete pod hbase-hbase-master-0 -n hbase
主備能正常切換
helm uninstall hbase-hdfs-ha -n hbase-hdfs-ha
# delete ns
kubectl delete ns hbase-hdfs-ha --force
git 地址:https://gitee.com/hadoop-bigdata/hbase-on-k8s

我們在微信上24小時期待你的聲音
解答本文疑問/技術咨詢/運營咨詢/技術建議/互聯網交流