|
| 1 | +--- |
| 2 | +keywords: [Kubernetes, deployment, GreptimeDB, datanode groups, CRD, installation, verification] |
| 3 | +description: Step-by-step guide to deploying a GreptimeDB cluster with datanode groups on Kubernetes, including prerequisites, configuration, installation, and verification. |
| 4 | +--- |
| 5 | + |
| 6 | +# Deploy a GreptimeDB Cluster with Datanode Groups |
| 7 | + |
| 8 | +In this guide, you will learn how to deploy a GreptimeDB cluster on Kubernetes with a datanode group consisting of multiple datanode instances. |
| 9 | + |
| 10 | +## Prerequisites |
| 11 | + |
| 12 | +- [Docker](https://docs.docker.com/get-started/get-docker/) >= v23.0.0 |
| 13 | +- [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/) >= v1.18.0 |
| 14 | +- [Helm](https://helm.sh/docs/intro/install/) >= v3.0.0 |
| 15 | +- [GreptimeDB Operator](https://github.com/GrepTimeTeam/greptimedb-operator) >= v0.3.0 |
| 16 | + |
| 17 | +## Upgrade operator |
| 18 | + |
| 19 | +Install the GreptimeDB Operator, setting the image version to be greater than or equal to `v0.3.0`. |
| 20 | +For detailed instructions on upgrading the operator, please refer to the [GreptimeDB Operator Management](/user-guide/deployments-administration/deploy-on-kubernetes/greptimedb-operator-management.md#upgrade) guide. |
| 21 | + |
| 22 | +## Datanode Groups Configuration |
| 23 | + |
| 24 | +In the enterprise edition, you can configure **datanode groups** to separate read and write workloads into different groups. |
| 25 | +The datanode accepts a `workload_types` field to distinguish its workload type. Supported types are **`hybrid`**, **`query`**, and **`ingest`**: |
| 26 | + |
| 27 | +* **`hybrid`** is the default and acts as a superset of `query` and `ingest`, allowing the datanode to handle both workloads. |
| 28 | +* **`query`** is optimized for read workloads, datanode only handle read workload. |
| 29 | +* **`ingest`** is optimized for write workloads, datanode only handle write workload. |
| 30 | + |
| 31 | +While `hybrid` is convenient, running both reads and writes on the same datanode may cause them to interfere with each other, for example, a large query may occupy too many resources, thus affecting the online ingestion. For best performance, it is recommended to separate read and write workloads into different datanode groups. |
| 32 | + |
| 33 | +When configuring datanode groups, ensure that each group includes a `name` field. The following `values.yaml` example demonstrates how to define separate datanode groups: |
| 34 | + |
| 35 | +```yaml |
| 36 | +danodata: |
| 37 | + enabled: false |
| 38 | + |
| 39 | +datanodeGroups: |
| 40 | + - name: write |
| 41 | + replicas: 1 |
| 42 | + config: | |
| 43 | + workload_types = ["ingest"] |
| 44 | + template: |
| 45 | + main: |
| 46 | + resources: |
| 47 | + requests: |
| 48 | + cpu: 4 |
| 49 | + memory: 8Gi |
| 50 | + storage: |
| 51 | + fs: |
| 52 | + storageClassName: ${storageClassName} |
| 53 | + storageSize: 100Gi |
| 54 | + - name: read |
| 55 | + replicas: 1 |
| 56 | + config: | |
| 57 | + workload_types = ["query"] |
| 58 | + template: |
| 59 | + main: |
| 60 | + resources: |
| 61 | + limits: |
| 62 | + cpu: 8 |
| 63 | + memory: 16Gi |
| 64 | + |
| 65 | +meta: |
| 66 | + replicas: 1 |
| 67 | + backendStorage: |
| 68 | + etcd: |
| 69 | + endpoints: |
| 70 | + - "etcd.etcd-cluster.svc.cluster.local:2379" |
| 71 | + |
| 72 | +frontend: |
| 73 | + replicas: 1 |
| 74 | +``` |
| 75 | +
|
| 76 | +For guidance on configuring alternative metadata storage backends for Metasrv, refer to the [Metadata Storage Configuration](/user-guide/deployments-administration/manage-metadata/configuration.md) documentation. |
| 77 | +
|
| 78 | +You can use the following command to apply the configuration: |
| 79 | +``` |
| 80 | +helm upgrade --install ${release-name} greptime/greptimedb-cluster --namespace ${namespace} -f values.yaml |
| 81 | +``` |
| 82 | + |
| 83 | +## Verify the Installation |
| 84 | + |
| 85 | +Check the status of the pods: |
| 86 | + |
| 87 | +```bash |
| 88 | +kubectl get pods -n default |
| 89 | +NAME READY STATUS RESTARTS AGE |
| 90 | +weny-cluster-datanode-read-0 1/1 Running 0 30s |
| 91 | +weny-cluster-datanode-write-0 1/1 Running 0 30s |
| 92 | +weny-cluster-frontend-774c76cffc-znvrw 1/1 Running 0 30s |
| 93 | +weny-cluster-meta-58977b7897-8k2sf 1/1 Running 0 90s |
| 94 | +``` |
| 95 | + |
| 96 | +## Next steps |
| 97 | + |
| 98 | +- For best performance, it is recommended to [Configure frontend groups](/user-guide/deployments-administration/deploy-on-kubernetes/configure-frontend-groups.md), which ensures complete separation of read and write traffic, achieving maximum isolation. |
| 99 | + |
| 100 | +- Add Read Replica for your table, please refer to [Read Replica](/enterprise/read-replica.md). |
0 commit comments