Skip to main content
Version: 3.0.0-alpha (Diátaxis)

Concepts — ClickHouse

Architecture

ClickHouse on Hikube is a managed service based on the ClickHouse Operator. It is a column-oriented SQL database optimized for data analytics (OLAP). The architecture relies on shards (horizontal partitioning) and replicas (high availability), coordinated by ClickHouse Keeper.


Terminology

TermDescription
ClickHouseKubernetes resource (apps.cozystack.io/v1alpha1) representing a managed ClickHouse cluster.
ShardHorizontal data partition. Each shard contains a subset of the total data.
ReplicaCopy of a shard. Provides redundancy and enables parallel reads.
ClickHouse KeeperDistributed coordination service (alternative to ZooKeeper) that manages replication and consensus between nodes.
ResticBackup tool for creating encrypted snapshots to S3 storage.
OLAPOnline Analytical Processing — data access model optimized for analytical queries (aggregations, column scans).
resourcesPresetPredefined resource profile (nano to 2xlarge).

Sharding and replication

Sharding

Sharding distributes data horizontally across multiple nodes:

  • Each shard contains a portion of the data
  • SELECT queries are executed in parallel across all shards
  • The shards parameter in the manifest determines the number of partitions

Replication

Each shard can have multiple replicas:

  • Replicas of the same shard contain identical data
  • Coordination is handled by ClickHouse Keeper
  • In case of a replica failure, reads are redirected to the others
tip

For small data volumes, a single shard with 2 replicas is sufficient. Add shards when the volume exceeds the capacity of a single node.


ClickHouse Keeper

ClickHouse Keeper replaces ZooKeeper for cluster coordination:

  • Manages consensus between replicas (Raft protocol)
  • Stores cluster metadata (distributed tables, replication)
  • Requires an odd number of instances (3 recommended) for quorum
Keeper parameterDescription
keeper.replicasNumber of Keeper instances (3 recommended)
keeper.resources / keeper.resourcesPresetResources allocated to Keeper
keeper.sizeKeeper storage size

Backup

ClickHouse on Hikube uses Restic for backups, following the same model as MySQL:

  • Encrypted snapshots stored in an S3 bucket
  • Scheduling via cron (backup.schedule)
  • Configurable retention strategy (backup.cleanupStrategy)

User management

Users are declared in the manifest with:

  • Password for authentication
  • Readonly flag: true for read-only access, false for full access

An admin user is automatically created with full privileges.


Resource presets

PresetCPUMemory
nano250m128Mi
micro500m256Mi
small1512Mi
medium11Gi
large22Gi
xlarge44Gi
2xlarge88Gi

Limits and quotas

ParameterValue
Max shardsDepending on tenant quota
Replicas per shardDepending on tenant quota
Storage size (size)Variable (in Gi)
Keeper instances3 recommended (odd number)

Further reading