Use different StorageClasses for CH replicas
Closed this issue · 1 comments
sati-max commented
We are using Clickhouse DB and Clickhouse Operator as part of our software and it works great. We use shards+replicas in clickhouse.
Is there a way to distribute clickhouse replicas so that each replica will use a different StorageClass?
Let's say we have StorageClass_1 and StorageClass_2, and clickhouse setup with 2 shards with 2 replicas each. So can we setup during deployment:
Shard_A
replica1 @ StorageClass_1
replica2 @ StorageClass_2
Shard_B
replica1 @ StorageClass_1
replica2 @ StorageClass_2
Slach commented
this is possible
you need to define separate podTemplates
item for each storage class
and use it in different replicas
something like that
apiVersion: "clickhouse.altinity.com/v1"
kind: "ClickHouseInstallation"
metadata:
name: "pvc-multi"
spec:
configuration:
clusters:
- name: "pvc-multi"
layout:
shards:
- replicas:
- podTemplate: sc1
- podTemplate: sc2
- replicas:
- podTemplate: sc1
- podTemplate: sc2
templates:
podTemplates:
- name: sc1
spec:
containers:
- name: clickhouse
image: clickhouse/clickhouse-server:latest
volumeMounts:
- name: data-storage-vc-template-1
mountPath: /var/lib/clickhouse
- name: sc2
spec:
containers:
- name: clickhouse
image: clickhouse/clickhouse-server:latest
volumeMounts:
- name: data-storage-vc-template-2
mountPath: /var/lib/clickhouse
volumeClaimTemplates:
- name: data-storage-vc-template-1
spec:
storageClassName: StorageClass_1
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
- name: data-storage-vc-template-2
spec:
storageClassName: StorageClass_2
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 2Gi