doris operator部署Doris集群教程

news2024/11/20 15:37:31

doris operator部署Doris集群教程

  • 前言
  • 部署流程

前言

kubernetes Operator是遵循kubernetes API和控制器模式,它主要用来封装运维业务逻辑的软件。它利用kubernetes的自定义资源定义(CRD)扩展API,并通过控制器模式监听资源对象,实现应用的部署和生命周期。大多数人使用kubernetes的时候是使用原生资源(pod、deployment、Service等),当然也可以使用operator来特定需求的新业务逻辑。
kubernetes Operator组成主要包括以下几个部分:
1.自定义资源定义(CRD):CRD 是对kubernetes API的扩展,允许用户定义自己的资源类型和属性。Operator使用CRD来定义自己管理的应用资源对象。
2.控制器(Controller):控制器监视自定义资源对象的状态,并根据定义的业务逻辑对资源对象进行协调,让状态达到预期。
3.管理器(manager):它本质上就是一个管理器框架。主要负责启动所有控制器,使多个控制器可以协同工作。而且它还提供共享缓存和客户端,不同控制器可以共享这些资源。实现了控制器逻辑的并发和同步。
Doris 官网上有 Kubernetes 部署的文档,无奈根据官网的文档,构建完镜像无法成功启动。故参考官网做了一些改动,成功启动 FE、BE 节点。此探索为临时部署方案,还需再完善、优化。目前好消息就是,Doris提供的Operator可以方便部署Doris集群。

部署流程

部署非常简单,首先在github下载Doris的operator项目,链接在doris operator。然后,根据operator部署Doris cluster,在本篇文章中,例子有三个节点,具体如下所示。

地址node
172.16.43.71fe 节点
172.16.43.72be节点
172.16.43.73be节点

doris cluster的yaml文件如下

# this yaml is the simplest mode to deploy doris with fe and be.
# the log and be storage use `EmptyDir` mode as disk. when the pod restart the log and storage will lost.
# This yaml only for experience deploy and usability on k8s about doris.

apiVersion: doris.selectdb.com/v1
kind: DorisCluster
metadata:
  labels:
    app.kubernetes.io/name: doriscluster
    app.kubernetes.io/instance: doriscluster-sample
    app.kubernetes.io/part-of: doris-operator
  name: doriscluster
  namespace: doris
spec:
  feSpec:
    replicas: 1
    image: selectdb/doris.fe-ubuntu:2.0.2
    envVars:
      - name: TZ
        value: "Asia/Shanghai"
    configMapInfo:
      # use kubectl create configmap fe-configmap --from-file=fe.conf
      configMapName: fe-configmap
      resolveKey: fe.conf
    service:
      type: NodePort
      servicePorts: 
      - nodePort: 31030
        targetPort: 9030
      - nodePort: 31031
        targetPort: 8030
    requests:
      memory: 1Gi
    limits:
      memory: 2Gi
    persistentVolumes:
    - mountPath: /opt/apache-doris/fe/doris-meta
      name: fe-data
      persistentVolumeClaimSpec:
        # when use specific storageclass, the storageClassName should reConfig, example as annotation.
        storageClassName: doris-fe-storage
        accessModes:
        - ReadWriteOnce
        resources:
          # notice: if the storage size less 5G, fe will not start normal.
          requests:
            storage: 5Gi
  beSpec:
    replicas: 2
    image: selectdb/doris.be-ubuntu:2.0.2
    envVars:
      - name: TZ
        value: "Asia/Shanghai"
    systemInitialization:
      command: ["/sbin/sysctl", "-w", "vm.max_map_count=2000000"]
    configMapInfo:
      # use kubectl create configmap be-configmap --from-file=be.conf
      configMapName: be-configmap
      resolveKey: be.conf
    persistentVolumes:
    - mountPath: /opt/apache-doris/be/storage
      name: be-data
      persistentVolumeClaimSpec:
        # when use specific storageclass, the storageClassName should reConfig, example as annotation.
        storageClassName: doris-be-storage
        accessModes:
        - ReadWriteOnce
        resources:
          requests:
            storage: 6Gi

operator的yaml文件定义如下

# permissions to do leader election.
apiVersion: v1
kind: Namespace
metadata:
  labels:
    control-plane: doris-operator
    app.kubernetes.io/name: namespace
    app.kubernetes.io/instance: doris
    app.kubernetes.io/component: doris-operator
    app.kubernetes.io/part-of: doris-operator
  name: doris
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  labels:
    app.kubernetes.io/name: role
    app.kubernetes.io/instance: leader-election-role
    app.kubernetes.io/component: rbac
    app.kubernetes.io/created-by: doris-operator
    app.kubernetes.io/part-of: doris-operator
    app.kubernetes.io/managed-by: kustomize
  name: leader-election-role
  namespace: doris
rules:
  - apiGroups:
      - ""
    resources:
      - configmaps
    verbs:
      - get
      - list
      - watch
      - create
      - update
      - patch
      - delete
  - apiGroups:
      - coordination.k8s.io
    resources:
      - leases
    verbs:
      - get
      - list
      - watch
      - create
      - update
      - patch
      - delete
  - apiGroups:
      - ""
    resources:
      - events
    verbs:
      - create
      - patch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  labels:
    app.kubernetes.io/name: rolebinding
    app.kubernetes.io/instance: leader-election-rolebinding
    app.kubernetes.io/component: rbac
    app.kubernetes.io/created-by: doris-operator
    app.kubernetes.io/part-of: doris-operator
    app.kubernetes.io/managed-by: kustomize
  name: leader-election-rolebinding
  namespace: doris
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: leader-election-role
subjects:
  - kind: ServiceAccount
    name: doris-operator
    namespace: doris
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  creationTimestamp: null
  name: doris-operator
rules:
  - apiGroups:
      - apps
    resources:
      - statefulsets
    verbs:
      - create
      - delete
      - get
      - list
      - patch
      - update
      - watch
  - apiGroups:
      - apps
    resources:
      - statefulsets/status
    verbs:
      - get
  - apiGroups:
      - autoscaling
    resources:
      - horizontalpodautoscalers
    verbs:
      - create
      - delete
      - get
      - list
      - patch
      - update
      - watch
  - apiGroups:
      - ""
    resources:
      - configmaps
    verbs:
      - get
      - list
      - watch
  - apiGroups:
      - ""
    resources:
      - endpoints
    verbs:
      - get
      - list
      - watch
  - apiGroups:
      - ""
    resources:
      - pods
    verbs:
      - get
      - list
      - watch
  - apiGroups:
      - ""
    resources:
      - secrets
    verbs:
      - get
      - list
      - watch
  - apiGroups:
      - ""
    resources:
      - serviceaccounts
    verbs:
      - create
      - delete
      - get
      - list
      - patch
      - update
      - watch
  - apiGroups:
      - ""
    resources:
      - services
    verbs:
      - create
      - delete
      - get
      - list
      - patch
      - update
      - watch
  - apiGroups:
      - doris.selectdb.com
    resources:
      - dorisclusters
    verbs:
      - create
      - delete
      - get
      - list
      - patch
      - update
      - watch
  - apiGroups:
      - doris.selectdb.com
    resources:
      - dorisclusters/finalizers
    verbs:
      - update
  - apiGroups:
      - doris.selectdb.com
    resources:
      - dorisclusters/status
    verbs:
      - get
      - patch
      - update
  - apiGroups:
      - rbac.authorization.k8s.io
    resources:
      - clusterrolebindings
    verbs:
      - create
      - delete
      - get
      - list
      - patch
      - update
      - watch
  - apiGroups:
      - rbac.authorization.k8s.io
    resources:
      - rolebindings
    verbs:
      - create
      - delete
      - get
      - list
      - patch
      - update
      - watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  labels:
    app.kubernetes.io/name: clusterrolebinding
    app.kubernetes.io/instance: doris-operator-rolebinding
    app.kubernetes.io/component: rbac
    app.kubernetes.io/created-by: doris-operator
    app.kubernetes.io/part-of: doris-operator
    app.kubernetes.io/managed-by: kustomize
  name: doris-operator-rolebinding
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: doris-operator
subjects:
  - kind: ServiceAccount
    name: doris-operator
    namespace: doris
---
apiVersion: v1
kind: ServiceAccount
metadata:
  labels:
    app.kubernetes.io/name: serviceaccount
    app.kubernetes.io/instance: controller-doris-operator-sa
    app.kubernetes.io/component: rbac
    app.kubernetes.io/created-by: doris-operator
    app.kubernetes.io/part-of: doris-operator
    app.kubernetes.io/managed-by: kustomize
  name: doris-operator
  namespace: doris
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: doris-operator
  namespace: doris
  labels:
    control-plane: doris-operator
    app.kubernetes.io/name: deployment
    app.kubernetes.io/instance: doris-operator
    app.kubernetes.io/component: doris-operator
    app.kubernetes.io/created-by: doris-operator
    app.kubernetes.io/part-of: doris-operator
spec:
  selector:
    matchLabels:
      control-plane: doris-operator
  replicas: 1
  template:
    metadata:
      annotations:
        kubectl.kubernetes.io/default-container: doris-operator
      labels:
        control-plane: doris-operator
    spec:
      # TODO(user): Uncomment the following code to configure the nodeAffinity expression
      # according to the platforms which are supported by your solution.
      # It is considered best practice to support multiple architectures. You can
      # build your manager image using the makefile target docker-buildx.
      # affinity:
      #   nodeAffinity:
      #     requiredDuringSchedulingIgnoredDuringExecution:
      #       nodeSelectorTerms:
      #         - matchExpressions:
      #           - key: kubernetes.io/arch
      #             operator: In
      #             values:
      #               - amd64
      #               - arm64
      #               - ppc64le
      #               - s390x
      #           - key: kubernetes.io/os
      #             operator: In
      #             values:
      #               - linux
      securityContext:
        runAsNonRoot: true
        # TODO(user): For common cases that do not require escalating privileges
        # it is recommended to ensure that all your Pods/Containers are restrictive.
        # More info: https://kubernetes.io/docs/concepts/security/pod-security-standards/#restricted
        # Please uncomment the following code if your project does NOT have to work on old Kubernetes
        # versions < 1.19 or on vendors versions which do NOT support this field by default (i.e. Openshift < 4.11 ).
        # seccompProfile:
        #   type: RuntimeDefault
      containers:
        - command:
            - /dorisoperator
          args:
            - --leader-elect
          image: selectdb/doris.k8s-operator:latest
          name: dorisoperator
          securityContext:
            allowPrivilegeEscalation: false
            capabilities:
              drop:
                - "ALL"
          livenessProbe:
            httpGet:
              path: /healthz
              port: 8081
            initialDelaySeconds: 15
            periodSeconds: 20
          readinessProbe:
            httpGet:
              path: /readyz
              port: 8081
            initialDelaySeconds: 5
            periodSeconds: 10
          # TODO(user): Configure the resources accordingly based on the project requirements.
          # More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
          resources:
            limits:
              cpu: "2"
              memory: 4Gi
            requests:
              cpu: "1"
              memory: 2Gi
      serviceAccountName: doris-operator
      terminationGracePeriodSeconds: 10

fe的storageclass的yaml文件如下

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
   name: doris-fe-storage
provisioner: kubernetes.io/no-provisioner
reclaimPolicy: Retain
volumeBindingMode: WaitForFirstConsumer

fe的pv定义yaml文件如下

apiVersion: v1
kind: PersistentVolume
metadata:
   name: fe-node-71
spec:
   capacity:
      storage: 10Gi
   volumeMode: Filesystem
   accessModes:
   - ReadWriteOnce
   persistentVolumeReclaimPolicy: Retain
   storageClassName: doris-fe-storage
   local:
      path: /data/doris/fe
   nodeAffinity:
      required:
         nodeSelectorTerms:
         - matchExpressions:
            - key: kubernetes.io/hostname
              operator: In
              values:
              - 172.16.43.71

be的storageclass定义yaml文件如下

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
   name: doris-be-storage
provisioner: kubernetes.io/no-provisioner
reclaimPolicy: Retain
volumeBindingMode: WaitForFirstConsumer

be的pv定义yaml文件如下

apiVersion: v1
kind: PersistentVolume
metadata:
   name: be-node-72
spec:
   capacity:
      storage: 10Gi
   volumeMode: Filesystem
   accessModes:
   - ReadWriteOnce
   persistentVolumeReclaimPolicy: Retain
   storageClassName: doris-be-storage
   local:
      path: /data/doris/be/storage
   nodeAffinity:
      required:
         nodeSelectorTerms:
         - matchExpressions:
            - key: kubernetes.io/hostname
              operator: In
              values:
              - 172.16.43.72
---
apiVersion: v1
kind: PersistentVolume
metadata:
   name: be-node-73
spec:
   capacity:
      storage: 10Gi
   volumeMode: Filesystem
   accessModes:
   - ReadWriteOnce
   persistentVolumeReclaimPolicy: Retain
   storageClassName: doris-be-storage
   local:
      path: /data/doris/be/storage
   nodeAffinity:
      required:
         nodeSelectorTerms:
         - matchExpressions:
            - key: kubernetes.io/hostname
              operator: In
              values:
              - 172.16.43.73

执行如下构建命令构建

kubectl apply -f doris-fe-st.yaml
kubectl apply -f doris-fe-pv.yaml
kubectl apply -f doris-be-st.yaml
kubectl apply -f doris-be-pv.yaml
kubectl apply -f operator.yaml -ndoris
kubectl apply -f doriscluster.yaml -ndoris

查看pvc确定是否绑定成功
在这里插入图片描述

查看pod 是否启动成功
在这里插入图片描述
执行show frontends命令查看fe的状态,结果如下
在这里插入图片描述
执行show backends命令查看be的状态,具体如下图
在这里插入图片描述
在这里插入图片描述

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1111919.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

CVPR 2018 基于累积注意力的视觉定位 Visual Grounding via Accumulated Attention 详解

Abstract&#xff1a; VG面临的主要挑战有3个&#xff1a;1 )查询的主要焦点是什么&#xff1b;2 )如何理解图像&#xff1b;3 )如何定位物体。 在本文中&#xff0c;我们将这些挑战形式化为三个注意力问题&#xff0c;并提出了一个累积注意力( A-ATT )机制来共同推理其中的挑战…

找不到msvcr120.dll无法执行代码?教你6种方法快速解决问题

在现代的计算机编程中&#xff0c;我们经常会遇到各种各样的问题。其中&#xff0c;“由于找不到msvcr120.dll无法执行代码”的问题是许多开发者都会遇到的一个常见难题。这个问题通常发生在我们试图运行使用Visual Studio 2013编译的程序时&#xff0c;因为msvcr120.dll是Micr…

【QT】QTreeWidget

新建项目 第一步&#xff1a;设置头标签 第二步&#xff1a;设置item 第三步&#xff1a;创建子item&#xff0c;挂载在顶层item下 完整代码 #include "widget.h" #include "ui_widget.h"Widget::Widget(QWidget *parent): QWidget(parent), ui(new Ui::W…

Unity Animation--动画剪辑(动画游戏对象)

保存新的动画剪辑后&#xff0c;就可以开始添加关键帧了。 可以使用两种不同的方法为GameObject设置动画。 Unity“动画”窗口&#xff1a;“记录模式”和“预览模式”。 记录模式下的动画窗口 在记录模式下&#xff0c;当您移动&#xff0c;旋转或以其他方式修改动画GameOb…

2022年下半年 软件设计师 上午试卷(前21题)

以下关于RISC&#xff08;精简指令集计算机&#xff09;特点的叙述中&#xff0c;错误的是 &#xff08;1&#xff09; 。 &#xff08;1&#xff09; A. 对存储器操作进行限制&#xff0c;使控制简单化 B. 指令种类多&#xff0c;指令功能强 C. 设置大量通用寄存器 D. 选…

通讯网关软件027——利用CommGate X2OPCUA实现OPC UA访问MSSQL服务器

本文介绍利用CommGate X2OPCUA实现OPC UA访问MS SQL数据库。CommGate X2OPCUA是宁波科安网信开发的网关软件&#xff0c;软件可以登录到网信智汇(http://wangxinzhihui.com)下载。 【案例】如下图所示&#xff0c;实现上位机通过OPC UA来获取MS SQL数据库的数据。 【解决方案】…

全栈开发 - 从 Vue 配置中解决 CORS 跨域问题(2分钟搞定)

目录 一、CORS 跨域问题解决 1.1、前言 1.2、解决办法 a&#xff09;修改统一配置的 axios 实例 b&#xff09;修改 config 文件夹下的 index.js 文件 c&#xff09;完成 一、CORS 跨域问题解决 1.1、前言 如果你后端使用的是微服务项目&#xff0c;通过配置网关可以很好的…

GEE打开NASA-USDA增强型SMAP全球土壤水分数据(10KM,2015-2020)

NASA-USDA增强型SMAP全球土壤水分数据&#xff08;10KM&#xff0c;2015-2020&#xff09; 一、GEE登录 首先需要注册一个Goole账号 在该网站中注册 二、创建GEE项目 按照上面操作&#xff0c;注册完后会创建一个自己的GEE项目。&#xff08;没有的话也可以从下面这个网站…

【网络】用代码讲解HTTP协议

http协议 前言正式开始HTTP协议URLURL格式中每个字段所代表的内容格式中每个字段的作用URL对于特殊符号的处理 HTTP格式快速构建http请求和响应的报文格式http requesthttp response 一些细节http demo web目录代码实现 HTTP请求方法表单GET和POST提交的区别其余方法 HTTP的状态…

什么是热阻?

电流流过导体时&#xff0c;在导体两端会产生电压差&#xff0c;这个电压差除以流过导体的电流就是这个导体的电阻&#xff0c;单位是欧姆。这就是欧姆定律&#xff0c;大家都知道的东西。 当热源的热量在物体中传递时&#xff0c;在物体上也会产生温度差&#xff0c;这个温度差…

面对DDoS和APT攻击,我们该如何有效防御?

关于DDoS&#xff08;Distributed Denial of Service&#xff09;分布式拒绝服务攻击&#xff0c;是指攻击者通过技术手段&#xff0c;在很短的时间内对目标攻击网站发出大量请求&#xff0c;极大地消耗相关网站的主机资源&#xff0c;导致其无法正常服务。 打个比方来说&#…

Ubuntu系统上传文件的多种方法-断网上传-安装包上传-物联网开发维护

一、背景 在全新的Ubuntu系统中&#xff0c;其实是无法执行ifconfig命令的&#xff0c;因为这需要net-tools才能执行。在某些无法连接到外网的情况下&#xff0c;我们常常通过将安装包上传或发送到Ubuntu系统中&#xff0c;解压并安装&#xff0c;以保证相关指令能够执行。 本文…

梯度下降算法(Gradient Descent)

GD 梯度下降法的含义是通过当前点的梯度&#xff08;偏导数&#xff09;的反方向寻找到新的迭代点&#xff0c;并从当前点移动到新的迭代点继续寻找新的迭代点&#xff0c;直到找到最优解&#xff0c;梯度下降的目的&#xff0c;就是为了最小化损失函数。 1、给定待优化连续可微…

基于Qt QSpinBox 微调框小案例

修改微调框数值的方式包括: 单击右侧的向上/向下按钮 按键盘的向上/向下键 在微调框获取焦点时,通过鼠标滚轮的上下滚动 当然了,也允许用户手动输入 其中: QSpinBox - 用于整数的显示和输入 QDoubleSpinBox - 用于浮点数的显示和输入 它们都是 QAbstractSpinBox 的子类,具…

机器人制作开源方案 | 行星探测车实现WiFi视频遥控功能

1. 功能描述 本文示例所实现的功能为&#xff1a;用手机APP&#xff0c;通过WiFi通信遥控R261样机行星探测车移动&#xff0c;以及打开、关闭行星探测车太阳翼。 2. 电子硬件 在这个示例中&#xff0c;我们采用了以下硬件&#xff0c;请大家参考&#xff1a; 主控板 Basra主控…

DRF反序列化时数据验证完毕返回的是None值

文章目录 错误复现serializers.pyview.py错误 解决方案正确的代码 错误复现 serializers.py class LoginSerializer(serializers.Serializer):username serializers.CharField(min_length5, max_length10, help_text"账号")password serializers.CharField(min_l…

STM32内部flash闪存的总结

最近在做无人船和机巢远程在线升级的项目&#xff0c;牵扯到flash的操作&#xff0c;特此记录&#xff0c;便于以后查找。IMU也用到过&#xff0c;当时没记录 具体细节看 E:\Documets\AY\a-project\IMU\IMU16500\S0IMU v3.3 study\User\Driver\source eeprom.c E:\Documets\A…

Looper分析

Looper分析 在 Handler 机制中&#xff0c;Looper 的作用是提供了一个消息循环 ( message loop ) 的机制&#xff0c;用于处理和分发消息。 Looper 是一个线程局部的对象&#xff0c;每个线程只能有一个 Looper 对象。它通过一个无限循环来不断地从消息队列中取出消息&#x…

How to add a jar to a project in eclipse?

Project -> Properties -> Java Build Path -> Libraries -> Add External JARs

50springboot私人健身与教练预约管理系统

大家好✌&#xff01;我是CZ淡陌。一名专注以理论为基础实战为主的技术博主&#xff0c;将再这里为大家分享优质的实战项目&#xff0c;本人在Java毕业设计领域有多年的经验&#xff0c;陆续会更新更多优质的Java实战项目&#xff0c;希望你能有所收获&#xff0c;少走一些弯路…