cluster-operations
Installation
SKILL.md
Cluster Operations
When to use this skill
Load when users ask about cluster management, distributed tables, or scaling.
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: can route to correct shard or write locally
Adding Nodes
- Install ClickHouse on new node
- Configure Keeper/ZooKeeper connection
- Update cluster config (
remote_servers) on all nodes - Create local tables on new node
- For ReplicatedMergeTree: data syncs automatically
- For non-replicated: manually copy data or re-insert
Removing Nodes
- Stop writes to the node
- Wait for replication queue to drain
SYSTEM DROP REPLICAfor replicated tables- Remove from cluster config
- Restart remaining nodes to pick up config
Resharding
- ClickHouse doesn't support online resharding natively
- Strategy: create new distributed table with new sharding scheme
- Use
INSERT INTO new_dist SELECT * FROM old_distto migrate - Or use
clickhouse-copierfor large-scale migrations
Monitoring Clusters
system.clusters— topology viewsystem.distributed_ddl_queue— DDL operation statussystem.replicas— per-table replication status- Cross-shard queries: use Distributed table or
remote()function
Related skills
More from duyet/clickhouse-monitoring
troubleshooting
Diagnose and resolve common ClickHouse issues: OOM, slow merges, replication lag, disk full, stuck mutations, and query failures.
2replication-guide
ReplicatedMergeTree operations, failover procedures, lag diagnosis, quorum writes, and Keeper management.
2query-optimization
Query optimization strategies: PREWHERE, JOIN patterns, materialized views, EXPLAIN analysis, index usage, and query profiling.
2storage-optimization
Compression codecs, TTL policies, tiered storage, part management, and disk space optimization.
2security-hardening
RBAC configuration, row policies, quotas, network security, audit logging, and access control best practices.
2migration-patterns
Schema migrations, ALTER patterns, engine changes, data backfill, and zero-downtime migration strategies.
2