cluster-operations

Installation
SKILL.md

Cluster Operations

Distributed Tables

  • CREATE TABLE dist ENGINE = Distributed(cluster, db, local_table, sharding_key)
  • Sharding key: rand() for even distribution, cityHash64(user_id) for user affinity
  • Reads: query all shards in parallel; Writes: route to correct shard or write locally

ON CLUSTER DDL

  • ALTER TABLE t ON CLUSTER '{cluster}' ADD COLUMN col Type — propagate schema to all replicas
  • CREATE TABLE t ON CLUSTER '{cluster}' AS template_db.template_table — clone across shards
  • distributed_ddl_output_mode: throw (fail on error), null (ignore), none, active
  • Check status: SELECT * FROM system.distributed_ddl_queue

Load Balancing and Read Routing

  • load_balancing: random, in_order, first_or_random, nearest_hostname
  • max_replica_delay_for_distributed_queries — skip lagging replicas
  • fallback_to_stale_replicas_for_distributed_queries=1 — use stale when all delayed
Installs
3
GitHub Stars
241
First Seen
Apr 19, 2026
cluster-operations — duyet/clickhouse-monitoring