Configure Doris Cluster
This document introduces how to configure a Doris cluster for production deployment.
Configure resources
Before deploying a Doris cluster, it is necessary to configure the resources for each component of the cluster depending on your needs. FE, BE, CN and Broker are the core service components of a Doris cluster. In a production environment, you need to configure resources of these components according to their needs. For details, refer to Hardware Recommendations.
To ensure the proper scheduling and stable operation of the components of the Doris cluster on Kubernetes, it is
recommended to set Guaranteed-level quality of service (QoS) by making limits
equal to requests
when configuring
resources.
For details, refer
to Configure Quality of Service for Pods.
If you are using a NUMA-based CPU, you need to enable Static
’s CPU management policy on the node for better
performance.
To allow the Doris cluster component to monopolize the corresponding CPU resources, the CPU quota
must be an integer greater than or equal to 1
, apart from setting Guaranteed-level QoS as mentioned above.
For details, refer
to Control CPU Management Policies on the Node.
Configure Doris deployment
Configuring Doris Cluster via DorisCluster
Custom Resource (CR):
A basic DorisCluster CR sample
# IT IS NOT SUITABLE FOR PRODUCTION USE.
# This YAML describes a basic Doris cluster with minimum resource requirements,
# which should be able to run in any Kubernetes cluster with storage support.
apiVersion: al-assad.github.io/v1beta1
kind: DorisCluster
metadata:
name: basic
spec:
# Image tag of fe, be, cn and broker components.
version: 2.0.3
## Doris FE configuration.
# When this "fe" configuration key is not set, the Doris FE component will not be deployed,
# and the FE components on the cluster will be deleted (but the pvc for fe persistent data
# will be retained).
fe:
baseImage: ghcr.io/linsoss/doris-fe
# The replica of fe must be an odd number, it is recommended to 3 in the production env.
replicas: 1
# Extra FE config, see: https://doris.apache.org/docs/dev/admin-manual/config/fe-config/
config:
prefer_compute_node_for_external_table: "true"
# The resource requirements. For production environments,
# please refer to: https://doris.apache.org/docs/dev/install/standard-deployment/#production-environment
requests:
cpu: 500m
memory: 1Gi
storage: 2Gi
# If storageClassName is not set, the default Storage Class of the Kubernetes cluster will be used.
# storageClassName: local
## Doris BE (mixed mode) configuration.
# When this "be" configuration key is not set, the Doris BE component will not be deployed,
# and the BE components on the cluster will be deleted (but the pvc for be persistent data
# will be retained).
be:
baseImage: ghcr.io/linsoss/doris-be
replicas: 1
# Extra BE config, see: https://doris.apache.org/docs/dev/admin-manual/config/be-config
config: { }
# The resource requirements. For production environments, please
# refer to: https://doris.apache.org/docs/dev/install/standard-deployment/#production-environment
requests:
cpu: 500m
memory: 1Gi
storage: 5Gi
# If storageClassName is not set, the default Storage Class of the Kubernetes cluster will be used.
# storageClassName: local
## Doris BE (computation mode) configuration.
# When this "cn" configuration key is not set, the Doris CN component will not be deployed,
# and the CN components on the cluster will be deleted.
cn:
baseImage: ghcr.io/linsoss/doris-cn
replicas: 1
# Extra BE config, see: https://doris.apache.org/docs/dev/admin-manual/config/be-config
config: { }
# The resource requirements. For production environments, please
# refer to: https://doris.apache.org/docs/dev/install/standard-deployment/#production-environment
requests:
cpu: 500m
memory: 1Gi
## Doris Broker configuration
# When this "broker" configuration key is not set, the Doris broker component will not be deployed,
# and the broker components on the cluster will be deleted.
broker:
baseImage: ghcr.io/linsoss/doris-broker
replicas: 1
# Extra Broker config.
config: { }
# The resource requirements. For production environments, please
# refer to: https://doris.apache.org/docs/dev/install/standard-deployment/#production-environment
requests:
cpu: 500m
memory: 512Mi
A advanced DorisCluster CR sample
apiVersion: al-assad.github.io/v1beta1
kind: DorisCluster
metadata:
name: basic
spec:
# Image tag of fe, be, cn and broker components.
version: 2.0.3
###############################
# Cluster Global Configuration #
###############################
## ImagePullPolicy of Doris Cluster Pods
## Ref: https://kubernetes.io/docs/concepts/configuration/overview/#container-images
# imagePullPolicy: IfNotPresent
## Ref: https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod
# imagePullSecrets:
# - name: secretName
## Customized busybox image for init container used by BE and CN.
# busyBoxImage: busybox:1.36
## Specifies the service account for FE/BE/CN/Broker components.
# serviceAccount: ""
## NodeSelector of pods。
## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/
# nodeSelector:
# node-role.kubernetes.io/doris: true
## Affinity for pod scheduling
## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
# affinity:
# podAntiAffinity:
# # require not to run FE pods on nodes where there's already a FE pod running
# # if setting this, you must ensure that at least `replicas` nodes are available in the cluster
# requiredDuringSchedulingIgnoredDuringExecution:
# - labelSelector:
# matchExpressions:
# - key: app.kubernetes.io/component
# operator: In
# values:
# - fe
# topologyKey: kubernetes.io/hostname
## Tolerations are applied to Doris cluster pods, allowing (but do not require) pods to be scheduled onto nodes
## with matching taints.
## This cluster-level `tolerations` only take effect when no component-level `tolerations` are set.
## E.g., if `fe.tolerations` is not empty, `tolerations` here will be ignored.
## Ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/
# tolerations:
# - effect: NoSchedule
# key: dedicated
# operator: Equal
# value: doris
## Specify pod priorities of pods in DorisCluster, default to empty.
## Can be overwritten by component settings.
## Ref: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/
# priorityClassName: system-cluster-critical
## Set update strategy of StatefulSet can be overwritten by the setting of each component.
## Defaults to RollingUpdate.
## Ref: https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#update-strategies
# statefulSetUpdateStrategy: RollingUpdate
## Hadoop's configuration that injected into FE, BE, CN and Broker pods.
# hadoopConf:
# ## Host name and IP address of Hadoop cluster
# hosts:
# - ip: 10.233.123.189
# name: hadoop-01
# - ip: 10.233.123.179
# name: hadoop-02
# - ip: 10.233.123.179
# name: hadoop-03
# ## Hadoop conf files
# configs:
# hdfs-site.xml: |
# <configuration>
# ...
# </configuration>
# hive-site.xml: |
# <configuration>
# ...
# </configuration>
###################
# FE Configuration #
###################
# When this "fe" configuration key is not set, the Doris FE component will not be deployed,
# and the FE components on the cluster will be deleted (but the pvc for fe persistent data
# will be retained).
fe:
#########################
# FE Basic Configuration #
#########################
## Base image of the FE component
baseImage: ghcr.io/linsoss/doris-fe
## The replica of fe must be an odd number, it is recommended to 3 in the production env.
replicas: 3
## Extra FE config, see: https://doris.apache.org/docs/dev/admin-manual/config/fe-config/
# config:
# prefer_compute_node_for_external_table: 'true'
# qe_max_connection: '2048'
## Describe the resource requirements. For production environments, please refer to: https://doris.apache.org/docs/dev/install/standard-deployment/#production-environment
## Ref: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/
requests:
cpu: '8'
memory: 8Gi
storage: 100Gi
# limits:
# cpu: '32'
# memory: 64Gi
## The storageClassName of the persistent volume for FE persistent data.
## If storageClassName is not set, the default Storage Class of the Kubernetes cluster will be used.
# storageClassName: local
## Defines Kubernetes service for doris-fe
# service:
# ## service type, only ClusterIP and NodePort support is available.
# type: NodePort
# ## Expose the FE query port to the Node Port, default 0 is a random port.
# queryPort: 0
# ## Expose the FE http port to the Node Port, default 0 is a random port.
# httpPort: 0
############################
# FE Advanced Configuration #
############################
## Annotations for FE pods
# annotations: {}
## Host aliases for FE pods, it will be merged with the hadoopConf field
## Ref: https://kubernetes.io/docs/concepts/services-networking/add-entries-to-pod-etc-hosts-with-host-aliases/
# hostAliases:
# - ip: 10.233.123.122
# hostnames:
# - bg01
# - ip: 10.233.123.123
# hostnames:
# - bg02
## List of environment variables to set in the container
## Ref: https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/
# additionalEnvs:
# - name: MY_ENV_1
# value: value1
# - name: MY_ENV_2
# valueFrom:
# fieldRef:
# fieldPath: status.myEnv2
## Custom sidecar containers can be injected into the FE pods,
## which can act as a tracing agent or for any other use case
# additionalContainers:
# - name: myCustomContainer
# image: ubuntu
## Custom additional volumes in FE pods.
## Ref: https://kubernetes.io/docs/concepts/storage/persistent-volumes/#types-of-persistent-volumes
# additionalVolumes:
# - name: nfs
# nfs:
# server: 192.168.0.2
# path: /nfs
## Custom additional volume mounts in FE pods.
# additionalVolumeMounts:
# # this must match `name` in `additionalVolumes`
# - name: nfs
# mountPath: /nfs
## The following block overwrites cluster-level configurations in `spec`
# serviceAccount: ""
# affinity: {}
# tolerations: {}
# priorityClassName: ""
# statefulSetUpdateStrategy: RollingUpdate
# nodeSelector:
# app.kubernetes.io/component: fe
###############################
# BE(mixed mode) Configuration #
###############################
# When this "be" configuration key is not set, the Doris BE component will not be deployed,
# and the BE components on the cluster will be deleted (but the pvc for be persistent data
# will be retained).
be:
#########################
# BE Basic Configuration #
#########################
## Base image of the BE component
baseImage: ghcr.io/linsoss/doris-be
## The replica of the BE component
replicas: 3
## Extra BE config, see: https://doris.apache.org/docs/dev/admin-manual/config/be-config
# config:
# external_table_connect_timeout_sec: '30 seconds'
# mem_limit: '90%'
## Describes the resource requirements. For production environments, please refer to: https://doris.apache.org/docs/dev/install/standard-deployment/#production-environment
## Ref: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/
requests:
cpu: '8'
memory: 32Gi
storage: 500Gi
# limits:
# cpu: '32'
# memory: 64Gi
## The storageClassName of the persistent volume for FE persistent data.
## If storageClassName is not set, the default Storage Class of the Kubernetes cluster will be used.
# storageClassName: local
############################
# BE Advanced Configuration #
############################
## The custom storage of BE used to support cold and hot storage separation.
## Ref: https://doris.apache.org/docs/1.2/install/standard-deployment/#deploy-be
## name: custom storage name
## medium: storage medium, SSD(hot storage) or HDD(cold storage)
## request: storage capacity, e.g. "500Gi"
## storageClassName: k8s storage class name for the pvc
# storage:
# - name: storage-cold-1
# medium: HDD
# request: 500Gi
# storageClassName: hdd-pool
# - name: storage-cold-2
# medium: HDD
# request: 500Gi
# storageClassName: hdd-pool
# - name: storage-hot
# medium: SSD
# request: 200Gi
# storageClassName: ssd-pool
## Whether to retain the default data storage mount for BE which is located at be/storage,
# retainDefaultStorage: false
## Annotations for BE pods
# annotations: {}
## Host aliases for BE pods, it will be merged with the hadoopConf field
## Ref: https://kubernetes.io/docs/concepts/services-networking/add-entries-to-pod-etc-hosts-with-host-aliases/
# hostAliases:
# - ip: 10.233.123.122
# hostnames:
# - bg01
# - ip: 10.233.123.123
# hostnames:
# - bg02
## List of environment variables to set in the container
## Ref: https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/
# additionalEnvs:
# - name: MY_ENV_1
# value: value1
# - name: MY_ENV_2
# valueFrom:
# fieldRef:
# fieldPath: status.myEnv2
## Custom sidecar containers can be injected into the BE pods,
## which can act as a tracing agent or for any other use case
# additionalContainers:
# - name: myCustomContainer
# image: ubuntu
## Custom additional volumes in BE pods.
## Ref: https://kubernetes.io/docs/concepts/storage/persistent-volumes/#types-of-persistent-volumes
# additionalVolumes:
# - name: nfs
# nfs:
# server: 192.168.0.2
# path: /nfs
## Custom additional volume mounts in BE pods.
# additionalVolumeMounts:
# # this must match `name` in `additionalVolumes`
# - name: nfs
# mountPath: /nfs
## The following block overwrites cluster-level configurations in `spec`
# serviceAccount: ""
# affinity: {}
# tolerations: {}
# priorityClassName: ""
# statefulSetUpdateStrategy: RollingUpdate
# nodeSelector:
# app.kubernetes.io/component: be
#####################################
# BE(computation mode) Configuration #
#####################################
# When this "cn" configuration key is not set, the Doris CN component will not be deployed,
# and the CN components on the cluster will be deleted.
cn:
#########################
# CN Basic Configuration #
#########################
## Base image of the CN component
baseImage: ghcr.io/linsoss/doris-cn
## The replica of the CN component
## When there is a DorisAutoscaler bound to the current DorisCluster, cn.replicas will not take effect.
## The actual number of replicas adjusted by DorisAutoscaler shall prevail.
replicas: 2
## Extra BE config, see: https://doris.apache.org/docs/dev/admin-manual/config/be-config
# config:
# external_table_connect_timeout_sec: '30 seconds'
# mem_limit: '90%'
## The resource requirements. For production environments, please refer to: https://doris.apache.org/docs/dev/install/standard-deployment/#production-environment
## Ref: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/
requests:
cpu: '8'
memory: 32Gi
# limits:
# cpu: '32'
# memory: 64Gi
############################
# CN Advanced Configuration #
############################
## Annotations for CN pods
# annotations: {}
## Host aliases for BE pods, it will be merged with the hadoopConf field
## Ref: https://kubernetes.io/docs/concepts/services-networking/add-entries-to-pod-etc-hosts-with-host-aliases/
# hostAliases:
# - ip: 10.233.123.122
# hostnames:
# - bg01
# - ip: 10.233.123.123
# hostnames:
# - bg02
## List of environment variables to set in the container
## Ref: https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/
# additionalEnvs:
# - name: MY_ENV_1
# value: value1
# - name: MY_ENV_2
# valueFrom:
# fieldRef:
# fieldPath: status.myEnv2
## Custom sidecar containers can be injected into the BE pods,
## which can act as a tracing agent or for any other use case
# additionalContainers:
# - name: myCustomContainer
# image: ubuntu
## Custom additional volumes in BE pods.
## Ref: https://kubernetes.io/docs/concepts/storage/persistent-volumes/#types-of-persistent-volumes
# additionalVolumes:
# - name: nfs
# nfs:
# server: 192.168.0.2
# path: /nfs
## Custom additional volume mounts in BE pods.
# additionalVolumeMounts:
# # this must match `name` in `additionalVolumes`
# - name: nfs
# mountPath: /nfs
## The following block overwrites cluster-level configurations in `spec`
# serviceAccount: ""
# affinity: {}
# tolerations: {}
# priorityClassName: ""
# statefulSetUpdateStrategy: RollingUpdate
# nodeSelector:
# app.kubernetes.io/component: cn
#######################
# Broker Configuration #
#######################
# When this "broker" configuration key is not set, the Doris broker component will not be deployed,
# and the broker components on the cluster will be deleted.
broker:
#############################
# Broker Basic Configuration #
#############################
## Base image of the Broker component
baseImage: ghcr.io/linsoss/doris-broker
## The replica of the Broker component
replicas: 1
## Extra Broker config.
config: { }
## Describe the resource requirements. For production environments, please refer to: https://doris.apache.org/docs/dev/install/standard-deployment/#production-environment.
## Ref: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/
requests:
cpu: '1'
memory: 2Gi
# limits:
# cpu: 8
# memory: 16Gi
################################
# Broker Advanced Configuration #
################################
## Annotations for Broker pods
# annotations: {}
## Host aliases for BE pods, it will be merged with the hadoopConf field
## Ref: https://kubernetes.io/docs/concepts/services-networking/add-entries-to-pod-etc-hosts-with-host-aliases/
# hostAliases:
# - ip: 10.233.123.122
# hostnames:
# - bg01
# - ip: 10.233.123.123
# hostnames:
# - bg02
## List of environment variables to set in the container
## Ref: https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/
# additionalEnvs:
# - name: MY_ENV_1
# value: value1
# - name: MY_ENV_2
# valueFrom:
# fieldRef:
# fieldPath: status.myEnv2
## Custom sidecar containers can be injected into the BE pods,
## which can act as a tracing agent or for any other use case
# additionalContainers:
# - name: myCustomContainer
# image: ubuntu
## Custom additional volumes in BE pods.
## Ref: https://kubernetes.io/docs/concepts/storage/persistent-volumes/#types-of-persistent-volumes
# additionalVolumes:
# - name: nfs
# nfs:
# server: 192.168.0.2
# path: /nfs
## Custom additional volume mounts in BE pods.
# additionalVolumeMounts:
# # this must match `name` in `additionalVolumes`
# - name: nfs
# mountPath: /nfs
## The following block overwrites cluster-level configurations in `spec`
# serviceAccount: ""
# affinity: {}
# tolerations: {}
# priorityClassName: ""
# statefulSetUpdateStrategy: RollingUpdate
# nodeSelector:
# app.kubernetes.io/component: broker
${cluster_name}
directory and save them
as ${cluster_name}/doris-cluster.yaml
. After modifying the configuration and applying it to Kubernetes, The new
configuration will be automatically applied to the Doris cluster.Cluster name
The cluster name can be configured by changing metadata.name
in the DorisCuster
CR.
Version
Usually, components in a cluster are in the same version.
It is recommended to configure spec.<fe/be/cn/broker>.baseImage
and spec.version
.
Here are the formats of the parameters:
spec.version
: the format isimageTag
, such as2.0.3
spec.<fe/be/cn/broker>.baseImage
: the format isimageName
, such asghcr.io/linsoss/doris-fe
Please note that you must use the Doris images built using doris-operator/images. Of course, you can also directly use the Doris images released by linsoss 😃:
Component | Image |
---|---|
FE | ghcr.io/linsoss/doris-fe |
BE | ghcr.io/linsoss/doris-be |
CN | ghcr.io/linsoss/doris-cn |
Broker | ghcr.io/linsoss/doris-broker |
Storage
You can set the storage class by modifying storageClassName
of each component in ${cluster_name}/doris-cluster.yaml
and ${cluster_name}/doris-monitor.yaml
.
Different components of a Doris cluster have different disk requirements. Before deploying a Doris cluster, refer to the Storage Configuration document to select an appropriate storage class for each component according to the storage classes supported by the current Kubernetes cluster and usage scenario.
If you need to configure cold-hot separation storage for Doris BE, you can refer to Cold-Hot Separation Storage for Doris BE.
Doris configuration
You can configure parameters for various Doris components using spec.<fe/be/cn/broker>.config
.
For example, if you want to modify the following configuration parameters for FE:
prefer_compute_node_for_external_table=true
enable_spark_load=true
You would modify the DorisCluster
configuration as follows:
spec:
fe:
config:
prefer_compute_node_for_external_table: 'true'
enable_spark_load: 'true'
enable_fqdn_mode
for FE.
Doris Operator will automatically set this parameter to true and inject it into the container.Service
By configuring spec.fe.service
, you can define different Service types such as ClusterIP
and NodePort
. By default,
Doris Operator creates an additional ClusterIP
type Service for FE.
ClusterIP
ClusterIP
exposes the service via an internal IP in the cluster. When choosing this service type, the service can only be accessed within the cluster using ClusterIP or the service domain (${cluster_name}-fe.${namespace}
).spec: doris: service: type: ClusterIP
NodePort
During local testing, you can choose to expose the service via NodePort. Doris Operator will bind the SQL query port and Web UI port of FE to the NodePort.
NodePort exposes the service using the node’s IP and a static port. By accessing
NodeIP + NodePort
, you can access a NodePort service from outside the cluster.spec: doris: service: type: NodePort
Hadoop connection configuration
When the Doris cluster needs to connect to Hadoop, the relevant Hadoop configuration files are essential.
The spec.hadoopConf
configuration item provides a convenient way to inject Hadoop configurations into FE, BE, CN, and
Broker components.
spec:
hadoopConf:
# Host name and IP address of Hadoop cluster
hosts:
- ip: 10.233.123.189
name: hadoop-01
- ip: 10.233.123.179
name: hadoop-02
- ip: 10.233.123.179
name: hadoop-03
# Hadoop conf file contents
configs:
hdfs-site.xml: |
<configuration>
...
</configuration>
hive-site.xml: |
<configuration>
...
</configuration>
High Availability of Physical Topology
Doris is a distributed database. Here are three methods to maintain physical topology high availability for Doris on Kubernetes.
Use nodeSelector to schedule Pods
By configuring the nodeSelector
field of each component, you can specify the specific nodes that the component Pods
are scheduled onto. For details on nodeSelector
, refer
to nodeSelector.
apiVersion: al-assad.github.io/v1beta1
kind: DorisCluster
# ...
spec:
fe:
nodeSelector:
node-role.kubernetes.io/fe: true
# ...
be:
nodeSelector:
node-role.kubernetes.io/be: true
# ...
cn:
nodeSelector:
node-role.kubernetes.io/cn: true
# ...
broker:
nodeSelector:
node-role.kubernetes.io/broker: true
Use tolerations to schedule Pods
By configuring the tolerations
field of each component, you can allow the component Pods to schedule onto nodes with
matching taints. For details on taints and
tolerations, refer
to Taints and Tolerations.
apiVersion: al-assad.github.io/v1beta1
kind: DorisCluster
# ...
spec:
fe:
tolerations:
- effect: NoSchedule
key: dedicated
operator: Equal
value: fe
# ...
be:
tolerations:
- effect: NoSchedule
key: dedicated
operator: Equal
value: be
# ...
cn:
tolerations:
- effect: NoSchedule
key: dedicated
operator: Equal
value: cn
# ...
broker:
tolerations:
- effect: NoSchedule
key: dedicated
operator: Equal
value: broker
# ...
Use affinity to schedule Pods
By configuring PodAntiAffinity
, you can avoid the situation in which different instances of the same component are
deployed on the same physical topology node.
In this way, disaster recovery (high availability) is achieved.
For the user guide of Affinity,
see Affinity & AntiAffinity.
Here is an example of avoiding the scheduling of FE pod on the same physical node:
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app.kubernetes.io/component
operator: In
values:
- fe
- key: app.kubernetes.io/instance
operator: In
values:
- ${name}
topologyKey: kubernetes.io/hostname