自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

【云原生】HBase on K8s 編排部署講解與實戰(zhàn)操作

云計算 云原生
HBase 良好的分布式架構(gòu)設(shè)計為海量數(shù)據(jù)的快速存儲、隨機訪問提供了可能,基于數(shù)據(jù)副本機制和分區(qū)機制可以輕松實現(xiàn)在線擴容、縮容和數(shù)據(jù)容災(zāi),是大數(shù)據(jù)領(lǐng)域中 Key-Value 數(shù)據(jù)結(jié)構(gòu)存儲最常用的數(shù)據(jù)庫方案。

一、概述

HBase 是一個面向列式存儲的分布式數(shù)據(jù)庫,其設(shè)計思想來源于 Google 的 BigTable 論文。HBase 底層存儲基于 HDFS 實現(xiàn),集群的管理基于 ZooKeeper 實現(xiàn)。HBase 良好的分布式架構(gòu)設(shè)計為海量數(shù)據(jù)的快速存儲、隨機訪問提供了可能,基于數(shù)據(jù)副本機制和分區(qū)機制可以輕松實現(xiàn)在線擴容、縮容和數(shù)據(jù)容災(zāi),是大數(shù)據(jù)領(lǐng)域中 Key-Value 數(shù)據(jù)結(jié)構(gòu)存儲最常用的數(shù)據(jù)庫方案。

圖片

  • 官方文檔:https://hbase.apache.org/book.html
  • GitHub地址:https://github.com/apache/hbase
  • 關(guān)于更多hbase的介紹,也可以參考我這篇文章:列式存儲的分布式數(shù)據(jù)庫——HBase(環(huán)境部署),
  • 因為hbase依賴于HDFS存儲,關(guān)于HDFS容器化部署可以參考我以下文章:【云原生】Hadoop on k8s 環(huán)境部署
  • 但是生產(chǎn)環(huán)境一般使用高可用的Hadoop的,關(guān)于高可用部署可參考我這篇文章:【云原生】Hadoop HA on k8s 環(huán)境部署
  • hbase依賴于Zookeeper,zookeeper容器化部署可以參考:【云原生】zookeeper + kafka on k8s 環(huán)境部署

二、開始編排部署(非高可用HDFS)

地址:https://artifacthub.io/packages/helm/hbase/hbase

1)下載chart 包

helm repo add hbase https://itboy87.github.io/bigdata-charts/

# hbase version 2.4.13
helm pull hbase/hbase --version 0.1.7

2)構(gòu)建鏡像

在下面連接hadoop高可用會重新構(gòu)建鏡像,這里就不重新構(gòu)建鏡像了,只是把遠程的包推送到本地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

3)修改yaml編排(非高可用HDFS)

  • hbase/values.yaml
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

# 禁用內(nèi)部的hadoop
hadoop:
enabled: false

# 禁用內(nèi)部的zookeeper
zookeeper:
enabled: false
  • hbase/templates/hbase-configmap.yaml
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

4)開始部署

# 先檢查語法
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

圖片

圖片

5)測試驗證

測試主備切換,重啟當前active master pod

kubectl delete pod hbase-hbase-master-0 -n hbase

主備能正常切換

圖片

6)卸載

helm uninstall hbase -n hbase
# delete ns
kubectl delete ns hbase --force

三、開始編排部署(高可用 HDFS)

1)下載chart 包

helm repo add hbase https://itboy87.github.io/bigdata-charts/

# hbase version 2.4.13
helm pull hbase/hbase --version 0.1.7

2)構(gòu)建鏡像

這里是基于上面的鏡像進行構(gòu)建,只是把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

開始構(gòu)建

docker build -t myharbor.com/bigdata/hbase-hdfs-ha:2.4.13.2 . --no-cache

### 參數(shù)解釋
# -t:指定鏡像名稱
# . :當前目錄Dockerfile
# -f:指定Dockerfile路徑
# --no-cache:不緩存

# 推送到harbor
docker push myharbor.com/bigdata/hbase-hdfs-ha:2.4.13.2

3)修改配置

  • hbase-hdfs-ha/values.yaml
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"
  • hbase-hdfs-ha/templates/hbase-configmap.yaml
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

圖片

圖片

5)測試驗證

測試主備切換,重啟當前active master pod

kubectl delete pod hbase-hbase-master-0 -n hbase

主備能正常切換

圖片

6)卸載

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

責任編輯:武曉燕 來源: 大數(shù)據(jù)與云原生技術(shù)分享
相關(guān)推薦

2022-11-06 21:31:11

云原生Sentinel集群模式

2023-03-06 07:19:50

2023-03-03 07:54:21

2022-11-08 08:55:31

2023-03-07 07:56:37

Sqoopk8s底層

2022-10-14 07:42:50

LuceneHTTPWeb

2022-10-10 12:54:00

Flink運維

2023-02-27 07:40:00

2023-09-11 00:09:18

2023-08-29 10:27:32

2022-12-13 09:01:50

云原生組件數(shù)據(jù)

2023-07-10 07:22:16

2022-11-28 17:22:32

高可用master節(jié)點

2022-12-26 08:14:57

K8sCronhpa定時彈性

2023-09-06 08:12:04

k8s云原生

2021-04-25 10:26:58

云計算云原生

2021-08-13 07:00:41

云原生k8sspringboot

2021-08-26 07:20:05

云原生K8sSpringboot

2023-11-06 01:17:25

主機容器選項

2024-09-26 09:50:07

點贊
收藏

51CTO技術(shù)棧公眾號