Kubernetes (K8s) 部署Doris

官網提供yaml地址下載部署

https://doris.apache.org/zh-CN/docs/2.0/install/cluster-deployment/k8s-deploy/install-env/

禁用和關閉 swap

在部署 Doris 時,建議關閉 swap 分區。

通過以下命令可以永久關閉 swap 分區。

echo "vm.swappiness = 0">> /etc/sysctl.conf
swapoff -a && swapon -a
sysctl -p

設置系統最大打開文件句柄數

vi /etc/security/limits.conf 
* soft nofile 65536
* hard nofile 65536

修改虛擬內存區域數量

修改虛擬內存區域至少 2000000

sysctl -w vm.max_map_count=2000000

關閉透明大頁

在部署 Doris 時,建議關閉透明大頁。

echo never > /sys/kernel/mm/transparent_hugepage/enabled
echo never > /sys/kernel/mm/transparent_hugepage/defrag

部署 Doris Operator
添加 Doris Cluster 資源定義
Doris Operator 使用自定義資源定義(Custom Resource Definition, CRD)擴展 Kubernetes。Doris Cluster 的 CRD 中封裝了對 Doris 對象的描述,例如對 FE 或 BE 的描述,詳細內容可以參考 doris-operator-api。在部署 Doris 前,需要先創建 Doris Cluster 的 CRD。
通過以下命令可以在 Kubernetes 環境中部署 Doris Cluster CRD:

kubectl create -f https://raw.githubusercontent.com/apache/doris-operator/master/config/crd/bases/doris.selectdb.com_dorisclusters.yaml

如果沒有外網,先將 CRD 文件下載到本地:

wget https://raw.githubusercontent.com/apache/doris-operator/master/config/crd/bases/doris.selectdb.com_dorisclusters.yaml
kubectl create -f ./doris.selectdb.com_dorisclusters.yaml

以下是期望輸出結果:

customresourcedefinition.apiextensions.k8s.io/dorisclusters.doris.selectdb.com created

在創建了 Doris Cluster CRD 后,可以通過以下命令查看創建的 CRD。

kubectl get crd | grep doris

以下為期望輸出結果:

dorisclusters.doris.selectdb.com                      2024-02-22T16:23:13Z

添加 Doris Operator
方案一:快速部署 Doris Operator
可以直接拉去倉庫中的 Doris Operator 模板進行快速部署。
使用以下命令可以在 Kubernetes 集群中部署 Doris Operator:

kubectl apply -f https://raw.githubusercontent.com/apache/doris-operator/master/config/operator/operator.yaml

以下為期望輸出結果:

namespace/doris created
role.rbac.authorization.k8s.io/leader-election-role created
rolebinding.rbac.authorization.k8s.io/leader-election-rolebinding created
clusterrole.rbac.authorization.k8s.io/doris-operator created
clusterrolebinding.rbac.authorization.k8s.io/doris-operator-rolebinding created
serviceaccount/doris-operator created
deployment.apps/doris-operator created

方案二:自定義部署 Doris Operator
在創建完 CRD 后,在 Kubernetes 集群上部署 Doris Operator 有兩種方式:在線與離線部署。
在 operator.yaml 文件中規范了部署 operator 的服務的最低要求。為了適配復雜的生產環境,可以下載 operator.yaml 文件后,按照期望更新其中配置。
在線安裝 Doris Operator
在修改 operator.yaml 文件后,可以使用以下命令部署 Doris Operator 服務:

kubectl apply -f /data/k8s-yaml/doris/operator.yaml

以下為期望輸出結果:

namespace/doris created
role.rbac.authorization.k8s.io/leader-election-role created
rolebinding.rbac.authorization.k8s.io/leader-election-rolebinding created
clusterrole.rbac.authorization.k8s.io/doris-operator created
clusterrolebinding.rbac.authorization.k8s.io/doris-operator-rolebinding created
serviceaccount/doris-operator created
deployment.apps/doris-operator created

離線安裝 Doris Operator
下載 operator 運行所需鏡像文件
如果服務器沒有連通外網,需要先下載對應的 operator 鏡像文件。Doris Operator 用到以下的鏡像:

selectdb/doris.k8s-operator:latest

在可以連通外網的服務器中運行以下的命令,可以將鏡像下載下來:

download doris operator image

docker pull selectdb/doris.k8s-operator:latest

save the doris operator image as a tar package

docker save -o doris.k8s-operator-latest.tar selectdb/doris.k8s-operator:latest

將已打包的 tar 文件放置到所有的 Kubernetes node 節點中,運行以下命令上傳鏡像:

docker load -i doris.k8s-operator-latest.tar

配置 Doris Operator
下載 operator.yaml 文件后,可以根據生產環境期望修改模板。

Doris Operator 在 Kubernetes 集群中是一個無狀態的 Deployment,可以根據需求修改如 limits、replica、label、namespace 等項目。如需要指定某一版本的 doirs operator 鏡像,可以在上傳鏡像后對 operator.yaml 文件做如下修改:

...
containers:- command:- /dorisoperatorargs:- --leader-electimage: selectdb/doris.k8s-operator:v1.0.0name: dorisoperatorsecurityContext:allowPrivilegeEscalation: falsecapabilities:drop:- "ALL"...

安裝 Doris Operator
在修改 Doris Operator 模板后,可以使用 apply 命令部署 Operator:

kubectl apply -f ./data/k8s-yaml/doris/operator.yaml

第三種方式部署
根據服務器環境,修改doris_be.yml文件。

apiVersion: v1
kind: Service
metadata:name: doris-be-cluster1labels:app: doris-be-cluster1
spec:ports:- port: 9060name: be-port- port: 8040name: webserver-port- port: 9050name: heartbeat-port #This name should be fixed. Doris will get the port information through this name- port: 8060name: brpc-portclusterIP: Noneselector:app: doris-be-cluster1
---
apiVersion: v1
kind: Service
metadata:name: doris-be-cluster1labels:app: doris-be-cluster1
spec:ports:- port: 9060name: be-port- port: 8040name: webserver-port- port: 9050name: heartbeat-port #This name should be fixed. Doris will get the port information through this name- port: 8060name: brpc-portclusterIP: Noneselector:app: doris-be-cluster1
---
apiVersion: apps/v1
kind: StatefulSet
metadata:name: doris-be-cluster1labels:app: doris-be-cluster1
spec:selector:matchLabels:app: doris-be-cluster1serviceName: doris-be-cluster1replicas: 3template:metadata:name: doris-be-cluster1labels:app: doris-be-cluster1spec:containers:- name: doris-be-cluster1#Need to change to real mirror information#image: apache-doris-be:test# 修改點1: 鏡像地址修改為真實doris鏡像,可在https://hub.docker.com/r/apache/doris/tags找到需要的鏡像版本image: apache/doris:2.0.0_alpha-be-x86_64imagePullPolicy: IfNotPresent#節點選擇nodeSelector:node: middlewareenv:#Specify the startup type as k8s to bypass some restrictions of the official image initialization script- name: BUILD_TYPEvalue: "k8s"# 修改點2: 增加環境變量,寫明FE的IP與端口- name: FE_MASTER_IPvalue: "doris-follower-cluster1-0.doris-follower-cluster1.doris.svc.cluster.local"- name: FE_MASTER_PORTvalue: "9030"ports:- containerPort: 9060name: be-port- containerPort: 8040name: webserver-port- containerPort: 9050name: heartbeat-port- containerPort: 8060name: brpc-portvolumeMounts:#Mount the configuration file in the way of configmap- name: confmountPath: /data/apache-doris/be/conf#Ifnot mounted, when enable_profile, error will be reported when querying the data from jdbc catalog#Error message: error setting certificate verify locations: CAfile:/etc/pki/tls/certs/ca-bundle.crt CApath: none- name: sysmountPath: /etc/pki# 修改點3: 掛載存儲subPath: pkireadOnly: true# 同修改點3- name: sysmountPath: /data/apache-doris/be/storagesubPath: storagevolumes:- name: confconfigMap:name: be-conf- name: sys# 修改點4:不使用hostpath,注釋掉#hostPath:#path: /etc/pki# 修改點5: 增加存儲配置,此處使用nfs-dynamic-class或者longhornvolumeClaimTemplates:- metadata:name: sysspec:storageClassName: nfs-dynamic-classaccessModes: [ "ReadWriteOnce" ]resources:requests:storage: 50Gi 
---
apiVersion: v1
kind: ConfigMap
metadata:name: be-conf
data:be.conf: |PPROF_TMPDIR="$DORIS_HOME/log/"sys_log_level = INFObe_port = 9060webserver_port = 8040heartbeat_service_port = 9050brpc_port = 8060# 修改點6: 修改網段為k8s使用網段,配置數據存儲路徑priority_networks = 10.44.0.0/16storage_root_path = /data/apache-doris/be/storage

根據服務器環境,修改doris_follower.yml文件

apiVersion: v1
kind: Service
metadata:name: doris-follower-cluster1labels:app: doris-follower-cluster1
spec:ports:- port: 8030name: http-port- port: 9020name: rpc-port- port: 9030name: query-port- port: 9010name: edit-log-port #This name should be fixed. Doris will get the port information through this nameclusterIP: Noneselector:app: doris-follower-cluster1
---
apiVersion: v1
kind: Service
metadata:name: doris-follower-cluster1labels:app: doris-follower-cluster1
spec:ports:- port: 8030name: http-port- port: 9020name: rpc-port- port: 9030name: query-port- port: 9010name: edit-log-port #This name should be fixed. Doris will get the port information through this nameclusterIP: Noneselector:app: doris-follower-cluster1
---
apiVersion: apps/v1
kind: StatefulSet
metadata:name: doris-follower-cluster1labels:app: doris-follower-cluster1
spec:selector:matchLabels:app: doris-follower-cluster1serviceName: doris-follower-cluster1# 修改點1: 修改fe副本為1replicas: 1template:metadata:name: doris-follower-cluster1labels:app: doris-follower-cluster1spec:containers:- name: doris-follower-cluster1#Need to change to real mirror information# 修改點2: 鏡像地址修改為真實doris鏡像,可在https://hub.docker.com/r/apache/doris/tags找到需要的鏡像版本image: apache/doris:2.0.0_alpha-fe-x86_64imagePullPolicy: IfNotPresent#節點選擇nodeSelector:node: middlewareenv:# 修改點3: 增加了APP_NAMESPACE與FE_IPADDRESS環境變量- name: APP_NAMESPACEvalueFrom:fieldRef:fieldPath: metadata.namespace- name: FE_IPADDRESSvalueFrom:fieldRef:fieldPath: status.podIP#Specify the startup type as k8s to bypass some restrictions of the official image initialization script- name: BUILD_TYPEvalue: "k8s"#Initialize the fe of three nodes- name: FE_INIT_NUMBER# 修改點4: 將數量改為1value: "1"#ServiceName of bakend_cn node,(if do not have bakend_cn node,do not configure this environment variable)# 修改點5: 不使用cn節點,注釋變量CN_SERVICE  CN_STATEFULSET#- name: CN_SERVICE#  value: "doris-cn-cluster1"#StatefulSetName of bakend_cn node,(if do not have bakend_cn node,do not configure this environment variable)#- name: CN_STATEFULSET#  value: "doris-cn-cluster1"#ServiceName of bakend node,(if do not have bakend node,do not configure this environment variable)- name: BE_SERVICEvalue: "doris-be-cluster1"#StatefulSetName of bakend node,(if do not have bakend node,do not configure this environment variable)- name: BE_STATEFULSETvalue: "doris-be-cluster1"#ServiceName of follower node,(if do not have follower node,do not configure this environment variable)- name: FE_SERVICEvalue: "doris-follower-cluster1"##StatefulSetName of follower node,(if do not have follower node,do not configure this environment variable)- name: FE_STATEFULSETvalue: "doris-follower-cluster1"ports:- containerPort: 8030name: http-port- containerPort: 9020name: rpc-port- containerPort: 9030name: query-port- containerPort: 9010name: edit-log-portvolumeMounts:#Mount the configuration file in the way of configmap- name: confmountPath: /data/apache-doris/fe/conf#In order to call the api of k8s- name: kube# 使用本地配置則為/root/.kube/configmountPath: /root/.kubereadOnly: true# 修改點6: 配置存儲,用于元數據持久化- name: metadatamountPath: /data/apache-doris/fe/doris-metavolumes:- name: confconfigMap:name: follower-conf- name: kube# 修改點7: 修改為使用configMap(此處可以不修改,使用本地配置)#hostPath:#path: /root/.kube/configconfigMap:name: kube-conf# 修改點8: 增加存儲配置,此處使用nfs-dynamic-class 或者 longhornvolumeClaimTemplates:- metadata:name: metadataspec:storageClassName: nfs-dynamic-class accessModes: [ "ReadWriteOnce" ]resources:requests:storage: 10Gi
---
apiVersion: v1
kind: ConfigMap
metadata:name: follower-conf
data:fe.conf: |# 修改點9: 修改網段為k8s使用網段priority_networks = 10.44.0.0/16#It can automatically maintain node information by getting the number of replicas of StatefulSet, similar to alter system add/drop backenable_deploy_manager = k8s#Automatically adjust the IP of the node according to the domain name (for example, after the pod is restarted, the domain name is still doris-be-cluster1-0-doris-be-cluster1.default.svc.cluster.local, but the IP may change from 172.16.0.9 to 172.16.0.10)enable_fqdn_mode = trueLOG_DIR = ${DORIS_HOME}/logsys_log_level = INFOhttp_port = 8030rpc_port = 9020query_port = 9030edit_log_port = 9010#Doris needs to generate the log4j configuration file according to the fe.yml configuration information, which is written in the same directory as fe.yml by default, but the config we mount is readonly, so specify this configuration to write the log4j file to another locationcustom_config_dir = /data/apache-doris/#when set to false, the backend will not be dropped and remaining in DECOMMISSION statedrop_backend_after_decommission = false# 修改點10: 增加元數據、java等配置mysql_service_nio_enabled = trueJAVA_OPTS = "-Xmx8192m -XX:+UseMembar -XX:SurvivorRatio=8 -XX:MaxTenuringThreshold=7 -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSClassUnloadingEnabled -XX:-CMSParallelRemarkEnabled -XX:CMSInitiatingOccupancyFraction=80 -XX:SoftRefLRUPolicyMSPerMB=0 -Xloggc:$DORIS_HOME/log/fe.gc.log.$DATE"JAVA_OPTS_FOR_JDK_9 = "-Xmx8192m -XX:SurvivorRatio=8 -XX:MaxTenuringThreshold=7 -XX:+CMSClassUnloadingEnabled -XX:-CMSParalle=80 -XX:SoftRefLRUPolicyMSPerMB=0 -Xlog:gc*:$DORIS_HOME/log/fe.gc.log.$DATE:time"meta_dir = /data/apache-doris/fe/doris-meta#metadata_failure_recovery = true

外部訪問sevice

kind: Service
apiVersion: v1
metadata:name: doris-follower-loacllabels:app: doris-follower-loacl
spec:ports:- name: httpprotocol: TCPport: 8030targetPort: 8030nodePort: 28030- name: tcpprotocol: TCPport: 9030targetPort: 9030nodePort: 29030selector:app: doris-follower-cluster1type: NodePort

部署

kubectl create ns doris
kubectl apply -f doris_be.yml -n doris
kubectl apply -f doris_follower.yml -n doris
kubectl apply -f doris-svc.yaml -n doris
  1. 訪問及使用, 默認賬號為root,無密碼
# web端訪問地址
http://[節點IP]:20803/login
# 使用mysql client連接地址
host: [節點IP]
port: 29030
user: root
pass: 
# 使用mysql client連接后可修改root密碼
SET PASSWORD FOR 'root' = PASSWORD('your_password');

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/web/91878.shtml
繁體地址,請注明出處:http://hk.pswp.cn/web/91878.shtml
英文地址,請注明出處:http://en.pswp.cn/web/91878.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

AI生成圖片工具分享!

CZL在線工具箱近日推出了一款基于Cloudflare Workers AI的免費在線AI圖片生成服務。該服務采用**Stable Diffusion XL(SDXL)**模型,為用戶提供高質量、逼真的圖像生成體驗。 核心特性 全球GPU網絡:基于Cloudflare全球分布式GPU網…

Spring Batch的2種STEP定義方式

Spring Batch的2種STEP定義方式 1. 第一種:基于Chunk-Oriented Processing(read,process,write)形式 適用場景: 大數據量批處理:適合需要分批次讀取、處理并寫入大量數據的場景(如數…

前端JS-調用單刪接口來刪除多個選中文件

當開發中遇到:服務端沒有刪除多個文件功能接口,只有單個刪除文件功能接口時,會遇到如何多選刪除文件效果最佳。await Promise.all(selectedDocPaths.map(async (path) > {try {await fileDelete(path)} catch (err) {throw new Error(刪除…

機器學習——過采樣(OverSampling),解決類別不平衡問題,案例:邏輯回歸 信用卡欺詐檢測

下采樣:機器學習——下采樣(UnderSampling),解決類別不平衡問題,案例:邏輯回歸 信用卡欺詐檢測-CSDN博客 (完整代碼在底部) 解決樣本不平衡問題:SMOTE 過采樣實戰講解 …

Ettus USRP X440 進行“超短波個人衛星信號的偵查與干擾”任務

結合 Ettus USRP X440 進行“超短波個人衛星信號的偵查與干擾”任務,可以構建一個高性能、靈活可編程的電子對抗系統原型平臺。以下是面向科研/工程/軍用驗證場景的構思和技術文案: 🛰? 項目名稱建議(可選)&#xff1…

如何在出售Windows11/10/8/7前徹底清除電腦數據

為了保護您的個人數據,在出售電腦前徹底清除數據是一個明智之舉。然而,僅僅刪除文件是不夠的,因為恢復工具通常可以恢復它們。因此,本指南分享了如何在出售電腦前清除數據,包括 Windows 11/10/8/7,確保您的…

Go語言實戰案例:多協程并發下載網頁內容

本文是《Go語言100個實戰案例 網絡與并發篇》第6篇,實戰演示如何使用 Goroutine 和 Channel,實現多協程并發抓取網頁內容,提升網絡請求效率,為構建爬蟲、內容聚合器、API 批量采集器打下基礎。一、實戰背景在互聯網項目中&#x…

分享鏈接實現狀態共享

有這么一個場景:就是有一些列表頁面,然后上面是有一些篩選項的,我去對這個列表做了一些篩選出來一個結果,然后我想把這個鏈接,或者說把這個篩選結構給分享出去,讓別人在打開這個頁面的時候,也是…

Fay數字人如何使用GPT-SOVITS進行TTS轉換以及遇到的一些問題

一、GPT-SoVITS 簡介 GPT-SoVITS 是一款開源的語音合成(TTS)工具,結合了 GPT 模型的文本理解能力與 SoVITS(Sound of Voice In Text-to-Speech)的聲紋模擬技術,能夠實現高自然度、個性化的語音合成。它支持…

HTML 顏色值

HTML 顏色值 引言 在網頁設計和開發中,顏色是一個重要的元素,它能夠幫助用戶更好地理解內容,提升視覺效果。HTML 顏色值是用于指定網頁中元素顏色的一種標準表示方法。本文將詳細介紹 HTML 顏色值的種類、表示方法以及在實際應用中的使用技巧。 HTML 顏色值種類 HTML 顏…

關于記錄一下“bug”,在做圖片上傳的時候出現的小問題

項目場景:之前的話寫過csdn,最近出現了一些小事情,所以耽誤了好久沒有更新,最近把以前的項目拿出來然后改了下環境就出現了一些問題,該項目使用SpringBoot3.5 SpringMVC Mybatis-Plus3.5.0,然后權限控制采…

數據結構:基礎知識和鏈表①

一、概念程序數據結構算法1.描述數據存儲和操作的結構 2.操作數據對象的方法二、衡量代碼的質量和效率 無論代碼操作數據量多大,希望程序代碼的運行時間保持恒定 隨著數據的增長,程序運行時間緩慢增長隨著數據的增長,程序運…

進階向:自動化天氣查詢工具(API調用)

自動化天氣查詢工具(API調用)完全指南天氣數據是日常生活中經常需要查詢的信息之一。本教程將介紹如何使用Python編寫一個自動化天氣查詢工具,通過調用開放的天氣API獲取實時天氣數據。這個工具適合完全不懂編程的新手學習,將從最…

【ROS2】常用命令

1、目錄結構在 ROS 2 包中,launch、urdf、rviz(通常指 RViz 配置文件)、config 等文件夾應直接放在包的根目錄下(與 robot_arm/ Python 模塊目錄同級)。這是 ROS 2 社區的通用約定,便于工具(如 …

基礎組件(三):mysql連接池

文章目錄一、MySQL連接池設計1. 連接池解決了什么問題?連接池的作用 (好處)為什么不創建多條連接而用連接池2. 同步和異步連接池的區別同步連接池(場景局限,應用服務器啟動時初始化資源)異步連接池&#xf…

FI文件包含漏洞

本地文件包含(LFI)文件包含開發人員將可重復使用的內容寫到單個文件中,使用時直接調用此文件,無需再次編寫,這種調用文件的過程一般被稱為文件包含。這樣編寫代碼能減少代碼冗余,降低代碼后期維護難度&…

rapidocr_web v1.0.0發布了

建立RapidOCRWeb獨立倉庫 終于將web這塊代碼移了出來,成立了獨立倉庫RapidOCRWeb (https://github.com/RapidAI/RapidOCRWeb )。這樣以來,RapidOCR倉庫下的各個衍生項目均有自己的獨立倉庫,可以單獨控制發版和維護。這也算是為RapidOCR減負了…

Arduino IDE離線安裝ESP8266板管理工具

文章目錄概要官網地址開發板管理地址安裝ESP8266開發板支持離線安裝額外記錄NODE啟動服務概要 Arduino IDE離線安裝ESP8266板管理工具&#xff0c;在線安裝因為網絡或者https的問題不能安裝 官網地址 Adruino&#xff1a;https://www.arduino.cc/ ESP8266項目&#xff1a;<…

兩款免費數據恢復軟件介紹,Win/Mac均可用

數據已成為我們生活與工作中不可或缺的重要組成部分。無論是珍貴的家庭照片、關鍵的工作文檔&#xff0c;還是重要的學習資料&#xff0c;都以數據的形式存儲在各類設備中。然而&#xff0c;數據丟失的情況卻時常發生&#xff0c;可能是誤操作刪除&#xff0c;可能是設備意外損…

Java開發中敏感信息加密存儲全解析:筑牢數據安全防線

Java開發中敏感信息加密存儲全解析&#xff1a;筑牢數據安全防線 一、引言 1.1 敏感信息存儲的現狀與挑戰 在數字化時代&#xff0c;數據已然成為企業和組織的核心資產之一&#xff0c;而敏感信息的存儲更是重中之重。從日常的用戶登錄密碼、身份證號碼&#xff0c;到金融領域…