Skip to content

Commit

Permalink
Merge pull request #28 from Al-assad/hot-cold-separation
Browse files Browse the repository at this point in the history
Supports Doris BE cold-hot separation storage configuration
  • Loading branch information
Al-assad authored Nov 26, 2023
2 parents f9185f3 + 98dcaee commit d59fe64
Show file tree
Hide file tree
Showing 11 changed files with 287 additions and 26 deletions.
28 changes: 27 additions & 1 deletion api/v1beta1/doriscluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package v1beta1
import (
appv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
)
Expand Down Expand Up @@ -117,10 +118,35 @@ type FESpec struct {
type BESpec struct {
DorisComponentSpec `json:",inline"`

// The storageClassName of the persistent volume for BE data storage.
// The default storageClassName of the persistent volume for BE data storage
// Defaults to Kubernetes default storage class.
// +optional
StorageClassName *string `json:"storageClassName,omitempty"`

// The custom storage of BE
// +optional
Storage []BEStorage `json:"storage,omitempty"`

// Whether to retain the default data storage mount for BE which is located at be/storage,
// Default to false
// +optional
RetainDefaultStorage bool `json:"retainDefaultStorage,omitempty"`
}

// BEStorage defines the custom storage of BE
type BEStorage struct {
// Name of the storage
Name string `json:"name"`

// Medium of the storage, the optional values include “SSD” (hot data) and “HDD” (cold data).
// Default to HDD
Medium string `json:"medium,omitempty"`

// Storage size requirements, e.g: "500Gi"
Request *resource.Quantity `json:"request"`

// K8s storage-class-name of the BE storage
StorageClassName *string `json:"storageClassName"`
}

// CNSpec contains details of CN members.
Expand Down
32 changes: 32 additions & 0 deletions api/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions config/crd/bases/al-assad.github.io_dorisclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2228,10 +2228,33 @@ spec:
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
type: object
retainDefaultStorage:
type: boolean
serviceAccount:
type: string
statefulSetUpdateStrategy:
type: string
storage:
items:
properties:
medium:
type: string
name:
type: string
request:
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
storageClassName:
type: string
required:
- name
- request
- storageClassName
type: object
type: array
storageClassName:
type: string
tolerations:
Expand Down
3 changes: 3 additions & 0 deletions docs/deploy/configure-doris-cluster/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ the [Storage Configuration document](../configure-storage-class) 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](../../maintian/cold-hot-separation-storage-for-doris-be/).

### Doris configuration

You can configure parameters for various Doris components using `spec.<fe/be/cn/broker>.config`.
Expand Down
3 changes: 3 additions & 0 deletions docs/deploy/configure-doris-cluster/index.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ Doris 集群中。
Doris 集群不同组件对磁盘的要求不一样,所以部署集群前,要根据当前 Kubernetes
集群支持的存储类型以及使用场景,参考[存储配置文档](../%E9%85%8D%E7%BD%AE-storage-class/)为 Doris 集群各组件选择合适的存储类型。

如果需要为 Doris BE
配置冷热存储分离存储,可以参考 [配置 Doris BE 冷热分离存储](../../maintian/%E9%85%8D%E7%BD%AE-doris-be-%E5%86%B7%E7%83%AD%E5%88%86%E7%A6%BB%E5%AD%98%E5%82%A8/)

### Doris 组件配置参数

可以通过 `spec.<fe/be/cn/broker>.config` 来配置各个组件的参数。
Expand Down
18 changes: 18 additions & 0 deletions docs/maintian/be-storage-separation/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
title: "Cold-Hot Separation Storage for Doris BE"
weight: 660
---

This document describes how to configure multi-disk storage and cold-hot separation storage for Doris BE on Kubernetes.

Doris BE supports multiple independent data storage directories, balancing the read and write performance as well as the
cost of hot and cold data by simultaneously mounting SSD and HDD storage medium.

The [Doris deployment documentation](https://doris.apache.org/docs/1.2/install/standard-deployment/#deploy-be) provides
details on this aspect. The Doris Operator offers a straightforward way to configure this process through
the `spec.be.storage` item in the DorisCluster CRD.

{{< readfile file="/examples/be-multiple-storage/doris-cluster.yaml" code="true" lang="yaml" >}}

For the preparation of StorageClass and PV, please refer
to: [Configuring Storage Class](../../deploy/configure-storage-class/).
15 changes: 15 additions & 0 deletions docs/maintian/be-storage-separation/index.zh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
title: "配置 Doris BE 冷热分离存储"
weight: 660
---

本文描述了如何为 Doris BE on Kubernetes 配置多磁盘存储和冷热分离存储。

Doris BE 支持多个独立数据存储目录,比如通过同时挂载 SSD 和 HDD 存储介质来平衡热数据,冷数据的读写性能和成本。

[Doris 部署文档](https://doris.apache.org/docs/1.2/install/standard-deployment/#deploy-be)中描述了这部分的内容,Doris
Operator 提供了一种简单的方式来实现这一过程的配置,通过DorisCluster CRD 的 `spec.be.storage` 配置项。

{{< readfile file="/examples/be-multiple-storage/doris-cluster.yaml" code="true" lang="yaml" >}}

关于 StorageClass 和 PV 的制备,请参考:[配置 Storage Class](../../deploy/%E9%85%8D%E7%BD%AE-storage-class/)
24 changes: 24 additions & 0 deletions examples/advanced/doris-cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,30 @@ spec:
# 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


## 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:
Expand Down
38 changes: 38 additions & 0 deletions examples/be-multiple-storage/doris-cluster.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
apiVersion: al-assad.github.io/v1beta1
kind: DorisCluster
metadata:
name: basic
spec:
version: 2.0.2
fe:
baseImage: ghcr.io/linsoss/doris-fe
replicas: 3
requests:
cpu: 500m
memory: 1Gi
storage: 50Gi
be:
baseImage: ghcr.io/linsoss/doris-be
replicas: 3
requests:
cpu: 500m
memory: 1Gi
## 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
Loading

0 comments on commit d59fe64

Please sign in to comment.