clickhouse

by KubeSphere

Helm chartv0.1.1App 21.1Verified publisher

Helm Chart for deploying a ClickHouse cluster with Zookeeper.

About this chart

RadonDB ClickHouse

RadonDB ClickHouse is an open-source, cloud-native, High-Availability cluster solutions based on ClickHouse.

ClickHouse is an open source column-oriented database management system capable of real time generation of analytical data reports using SQL queries.

Github

https://github.com/radondb/clickhouse-cluster-helm

Introduction

A ClickHouse cluster relies on ZooKeeper to store metadata.

So this chart will install ZooKeeper and ClickHouse.

Prerequisites

  • Kubernetes 1.10+ with Beta APIs enabled
  • PV provisioner support in the underlying infrastructure
  • Helm 3.0-beta3+

Installing the Chart

The command deploys MySQL cluster on the Kubernetes cluster in the default configuration. The configuration section lists the parameters that can be configured during installation.

$ helm repo add radonck https://radondb.github.io/clickhouse-cluster-helm/
$ helm repo update
$ helm install clickhouse radonck/clickhouse
$  helm list 
NAME      	NAMESPACE	REVISION	UPDATED                                	STATUS  	CHART           	APP VERSION
clickhouse	default  	1       	2021-06-07 07:55:42.860240764 +0000 UTC	deployed	clickhouse-0.1.0	21.1    

In default, the chart will create a ClickHouse Cluster with one shard and two replicas.

Uninstall

To uninstall/delete the clickhouse deployment:

$ helm delete clickhouse

To delete the pvc:

kubectl delete pvc ck-datadir-clickhouse-s0-r0-0 
kubectl delete pvc ck-datadir-clickhouse-s0-r1-0 
kubectl delete pvc datadir-volume-zk-clickhouse-0 
kubectl delete pvc datadir-volume-zk-clickhouse-1 
kubectl delete pvc datadir-volume-zk-clickhouse-2

The commands remove all the Kubernetes components associated with the chart and deletes the release completely.

Configuration

The following table lists the configurable parameters of the RadonDB MySQL chart and their default values.

ParameterDescriptionDefault
clickhouse.clusterNameClickHouse Default Cluster Namecluster
clickhouse.resources.cpuClickHouse Resource/Limit cpu0.5
clickhouse.resources.memoryClickHouse Resource/Limit memory1Gi
clickhouse.users.usernameClickHouse user namedefault
clickhouse.users.passwordClickHouse user passwordC1ickh0use
clickhouse.ports.nativePort for the native CLI interface9000
clickhouse.ports.httpPort for the HTTP/REST interface8123
clickhouse.shards.nameShart configurationshard0
clickhouse.shards.replicasReplicas configurationshard0-replica0, shard0-replica1
clickhouse.imageClickHouse Imagetceason/clickhouse-server:v21.1.3.32-stable
clickhouse.imagePullPolicyClickHouse Image pull policyIfNotPresent
clickhouse.service.typeType of the service.ClusterIP
clickhouse.livenessProbe.initialDelaySecondsDelay before ClickHouse liveness probe is initiated30
clickhouse.livenessProbe.periodSecondsHow often to perform the ClickHouse probe30
clickhouse.livenessProbe.timeoutSecondsWhen the probe times out5
clickhouse.livenessProbe.failureThresholdClickHouse Failure Threshold3
clickhouse.livenessProbe.successThresholdClickHouse Success Threshold1
zookeeper.replicasNums of Zookeeper replicas3
zookeeper.imageZookeeper Image3
zookeeper.imagePullPolicyZookeeper Image pull policyIfNotPresent
zookeeper.resources.cpuzookeeper Resource/Limit cpu0.5
zookeeper.resources.memoryzookeeper Resource/Limit memory1Gi

Specify each parameter using the --set key=value[,key=value] argument to helm install. For example,

$ cd clickhouse-cluster-helm/clickhouse/
$ helm install clickhouse \
  --set clickhouse.users[0].username=my-user,clickhouse.users[0].password=my-password .

The above command creates a standard database user named my-user, with the password my-password.

$ kubectl exec -it clickhouse-s0-r0-0 -- clickhouse client -u my-user --password=my-password --query='select hostName()'
clickhouse-s0-r0-0

Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example,

$ cd clickhouse-cluster-helm/clickhouse/
$ helm install clickhouse -f values.yaml .

Persistence

You can configure a Pod to use a PersistentVolumeClaim(PVC) for storage. In default, PVC mount on the /var/lib/clickhouse directory.

  1. You should create a Pod that uses the above PVC for storage.

  2. You should create a PVC that is automatically bound to a suitable PersistentVolume(PV).

Note PVC can use different PV, so using the different PV show the different performance.

Deploy clickhouse with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has clickhouse on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartclickhouse is pinned at v0.1.1 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply