Deploy GreptimeDB Cluster
Before the deployment, make sure you have already installed GreptimeDB Operator on your Kubernetes cluster.
Using Helm for deployment
Create an etcd cluster
First, establish an etcd cluster to support GreptimeDB by executing the following command:
helm upgrade \
--install etcd oci://registry-1.docker.io/bitnamicharts/etcd \
--set replicaCount=3 \
--set auth.rbac.create=false \
--set auth.rbac.token.enabled=false \
--create-namespace \
-n etcd-cluster
After the installation,
you can get the etcd cluster endpoints etcd.etcd.svc.cluster.local:2379
from the installation logs.
The endpoints are required for deploying the GreptimeDB cluster in the subsequent step.
Create a GreptimeDB cluster
Deploy the GreptimeDB cluster, ensuring it connects to the previously established etcd cluster:
helm install greptimedb greptime/greptimedb-cluster \
--set meta.etcdEndpoints=etcd.etcd-cluster.svc.cluster.local:2379 \
--create-namespace \
-n greptimedb-cluster
Setting Resource requests and limits
The GreptimeDB Helm charts enable you to specify resource requests and limits for each component within your deployment.
Here's how you can configure these settings:
helm install greptimedb greptime/greptimedb-cluster \
--set meta.etcdEndpoints=etcd.etcd-cluster.svc.cluster.local:2379 \
--set meta.podTemplate.main.resources.requests.cpu=<cpu-resource> \
--set meta.podTemplate.main.resources.requests.memory=<mem-resource> \
--set datanode.podTemplate.main.resources.requests.cpu=<cpu-resource> \
--set datanode.podTemplate.main.resources.requests.memory=<mem-resource> \
--set frontend.podTemplate.main.resources.requests.cpu=<cpu-resource> \
--set frontend.podTemplate.main.resources.requests.memory=<mem-resource> \
--create-namespace \
-n greptimedb-cluster
For a comprehensive list of configurable values via Helm, please refer to the value configuration.
Using kubectl for deployment
Alternatively, you can manually create a GreptimeDB cluster using kubectl
.
Start by creating a configuration file named greptimedb-cluster.yaml
with the following content:
apiVersion: greptime.io/v1alpha1
kind: GreptimeDBCluster
metadata:
name: greptimedb
namespace: greptimedb-cluster
spec:
base:
main:
image: greptime/greptimedb
frontend:
replicas: 1
meta:
replicas: 1
etcdEndpoints:
- "etcd.etcd-cluster.svc.cluster.local:2379"
datanode:
replicas: 3
Apply this configuration to instantiate the GreptimeDB cluster:
kubectl apply -f greptimedb-cluster.yaml
Connect to the cluster
After the installation, you can use kubectl port-forward
to forward the service ports of the GreptimeDB cluster:
# You can use the MySQL or PostgreSQL client to connect the cluster, for example: 'mysql -h 127.0.0.1 -P 4002'.
# HTTP port: 4000
# gRPC port: 4001
# MySQL port: 4002
# PostgreSQL port: 4003
kubectl port-forward -n greptimedb-cluster svc/greptimedb-frontend 4000:4000 4001:4001 4002:4002 4003:4003 > connections.out &
Then you can use the MySQL client to connect to the cluster.