Altinity / Altinity/clickhouse-operator

Question: change keeper replica count (decrease 5 -> 3)

Open
#1,639 21 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Keeper
Dominant language
Go
Stars
2.6k
Forks
574
Avg merge
8d 6h
Merged PRs (30d)
6

Description

So I have a Clickhouse cluster of 3 shards and 2 replicas. When I created the keeper I added 5 keepers (not sure why).

My question is, is it safe to just decrease that value to 3 keepers and update the config spec.configuration.zookeeper.nodes to point to the 3 keepers?

ClickHouseKeeperInstallation:

apiVersion: "clickhouse-keeper.altinity.com/v1"
kind: "ClickHouseKeeperInstallation"
metadata:
  name: keeper
spec:
  configuration:
    clusters:
      - name: "cluster-name"
        layout:
          replicasCount: 5
    settings:
      logger/level: "trace"
      logger/console: "true"
      listen_host: "0.0.0.0"
      keeper_server/four_letter_word_white_list: "*"
      keeper_server/coordination_settings/raft_logs_level: "information"
      prometheus/endpoint: "/metrics"
      prometheus/port: "7000"
      prometheus/metrics: "true"
      prometheus/events: "true"
      prometheus/asynchronous_metrics: "true"
      prometheus/status_info: "false"

  defaults:
    templates:
      podTemplate: default
      dataVolumeClaimTemplate: default

  templates:
    podTemplates:
      - name: default
        metadata:
          labels:
            app: clickhouse-keeper
        spec:
          nodeSelector:
            node.kubernetes.io/instance-type: ccx13
          affinity:
            podAntiAffinity:
              requiredDuringSchedulingIgnoredDuringExecution:
                - labelSelector:
                    matchExpressions:
                      - key: "app"
                        operator: In
                        values:
                          - clickhouse-keeper
                  topologyKey: "kubernetes.io/hostname"
          containers:
            - name: clickhouse-keeper
              imagePullPolicy: IfNotPresent
              image: clickhouse/clickhouse-keeper:24.12
              resources:
                requests:
                  memory: "500Mi"
                  cpu: "0.2"
                limits:
                  memory: "1Gi"
                  cpu: "1"
          securityContext:
            fsGroup: 101

    volumeClaimTemplates:
      - name: default
        reclaimPolicy: Retain
        spec:
          accessModes:
            - ReadWriteOnce
          resources:
            requests:
              storage: 5Gi

ClickhouseInstallation (relevant part):

apiVersion: "clickhouse.altinity.com/v1"
kind: "ClickHouseInstallation"
metadata:
  name: "chi-cluster"
spec:
  defaults:
    templates: 
      dataVolumeClaimTemplate: default
      podTemplate: clickhouse-pod-template
      serviceTemplate: svc-template
  configuration:
    zookeeper:
      nodes:
        - host: chk-keeper-openpanel-0-0
          port: 2181
        - host: chk-keeper-openpanel-0-1
          port: 2181
        - host: chk-keeper-openpanel-0-2
          port: 2181
        - host: chk-keeper-openpanel-0-3
          port: 2181
        - host: chk-keeper-openpanel-0-4
          port: 2181
    clusters:
      - name: "cluster-name"
        secure: "yes"
        layout:
          shardsCount: 3
          replicasCount: 2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the ClickHouseKeeperInstallation configuration at clusters.layout.replicasCount and the ClickHouseInstallation configuration at zookeeper.nodes. Determine the documented procedure and safety requirements for reducing the keeper count, then update the relevant operator documentation if an appropriate location is identified.

Written by the indexing model from the issue text.

Assessment

Tech stack
kubernetes
Domain
databases, infrastructure
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.