π A comprehensive 6-8 week training program for mastering ClickHouse from fundamentals to production deployment
This repository contains a complete ClickHouse training curriculum designed to take you from beginner to expert. The course covers everything from basic architecture to advanced topics like sharding, replication, real-time ingestion, and production migrations.
- Duration: 6-8 weeks
- Total Hours: 66-88 hours
- Modules: 10 comprehensive modules
- Session Frequency: 2-3 sessions per week
- Session Length: 2-3 hours each
- Code Examples: 100+ production-ready SQL examples
- Configurations: Complete Docker, config, and deployment files
clickhouse-ks/
βββ index.html # Main landing page (start here!)
βββ ch-kt-roadmap.pdf # Training roadmap PDF
β
βββ HTML Modules (Interactive Learning)
βββ module-1-fundamentals.html # Module 1: Fundamentals & Architecture
βββ module-2-table-engines.html # Module 2: Table Engines & Data Modeling
βββ module-3-sharding.html # Module 3: Sharding Strategy & Distribution
βββ module-4-replication.html # Module 4: Replication & High Availability
βββ module-5-cluster-deployment.html # Module 5: Full Cluster Deployment
βββ module-6-query-optimization.html # Module 6: Query Optimization & Performance
βββ module-7-backup-recovery.html # Module 7: Backup, Recovery & PITR
βββ module-8-disaster-recovery.html # Module 8: Disaster Recovery & Business Continuity
βββ module-9-kafka-ingestion.html # Module 9: Kafka-Based Real-Time Ingestion
βββ module-10-migration.html # Module 10: Migration from MongoDB/MySQL
β
βββ notion-guides/ # Concise Notion-style markdown guides
β βββ module-1-fundamentals.md
β βββ module-2-table-engines.md
β βββ module-3-sharding.md
β βββ module-4-replication.md
β βββ module-5-cluster-deployment.md
β βββ module-6-query-optimization.md
β βββ module-7-backup-recovery.md
β βββ module-8-disaster-recovery.md
β βββ module-9-kafka-ingestion.md
β βββ module-10-migration.md
β
βββ code-examples/ # Production-ready code examples
βββ demos/ # β Self-contained per-module demos (recommended)
β βββ README.md # Index + standard lifecycle
β βββ module-1-fundamentals/ # single Β· MergeTree, parts, partitions
β βββ module-2-table-engines/ # single Β· Replacing/Summing/Aggregating/...
β βββ module-3-sharding/ # cluster Β· Distributed, sharding key
β βββ module-4-replication/ # cluster Β· ReplicatedMergeTree + ZK + drills
β βββ module-5-cluster-deploy/ # cluster Β· ON CLUSTER, cluster()/remote()
β βββ module-6-query-opt/ # single Β· 60M rows, projections, skip-idx
β βββ module-7-backup/ # single + MinIO Β· BACKUP/RESTORE Disk + S3
β βββ module-8-dr/ # cluster Β· 4 disaster-recovery drills
β βββ module-9-kafka/ # kafka Β· Kafka engine + MV pipeline
β
βββ sql/ # Stand-alone SQL snippets per module
β βββ module-1/ ... module-10/
β
βββ configs/ # Reference ClickHouse configs (legacy)
β βββ config.xml Β· users.xml Β· metrika.xml
β βββ keeper_config.xml Β· macros.xml
β
βββ docker/ # Legacy shared Docker stacks
βββ docker-compose-single.yml Β· -cluster.yml Β· -kafka.yml
βββ docker-compose-migration.yml Β· -monitoring.yml
βββ init-scripts/ Β· configs/
ai-changes-md/ # Archived AI-generated artefacts
# (notion-sync scripts, status summaries,
# one-shot HTML fixers β kept for history)
Prefer
code-examples/demos/. Each module folder there is a complete, standalone Docker example with its own compose file, configs, andup.sh / run.sh / down.sh. The legacycode-examples/docker/stacks are still around for reference but aren't required.
There are three ways to engage with the material β pick whichever matches how you learn:
| Path | Best for | Where |
|---|---|---|
| π³ Hands-on demos | Learn by running real ClickHouse | code-examples/demos/module-N-*/ |
| π Interactive HTML | Theory + diagrams in your browser | index.html |
| π Notion guides | Quick reference / cheat-sheets | notion-guides/module-N-*.md |
Each module under code-examples/demos/ is a self-contained Docker
example: its own compose file, configs, SQL, and lifecycle scripts. No shared
root infrastructure.
cd code-examples/demos/module-1-fundamentals/
./up.sh # docker compose up -d, wait for health
./run.sh # run the demo (idempotent β re-runnable)
./down.sh # docker compose down -v (drops volumes)./run.sh self-bootstraps β if the stack isn't already up, it calls
up.sh first.
| Module | Demo (core + extras) | Stack | Host ports |
|---|---|---|---|
| 1 | MergeTree, parts, partitions, OPTIMIZE Β· TTL Β· codecs Β· Array/Tuple/Map/Nested/Enum Β· HTTP API | single (m1-) |
8123, 9000 |
| 2 | Replacing/Summing/Aggregating/Collapsing/Log/Memory/Buffer Β· VersionedCollapsing Β· Materialized View Β· Nested | single (m2-) |
8123, 9000 |
| 3 | Distributed, cityHash64 sharding, internal_replication Β· weighted shards Β· alt hash keys (rand/intDiv/xxHash) | cluster (m3-) |
8123-8128, 9000-9005 |
| 4 | ReplicatedMergeTree, ZK, kill-replica drill Β· insert_quorum Β· select_sequential_consistency Β· Keeper note | cluster (m4-) |
8123-8128, 9000-9005 |
| 5 | ON CLUSTER DDL, cluster()/remote()/clusterAll Β· users/roles/quotas Β· Prometheus endpoint Β· TLS sketch | cluster (m5-) |
8123-8128, 9000-9005 |
| 6 | PK/sorting key, projections, bloom-filter skip-idx Β· PREWHERE Β· SAMPLE Β· ANY/ALL/Dictionary JOINs Β· MV | single (m6-) |
8123, 9000 |
| 7 | FREEZE, BACKUP/RESTORE Disk + S3 (MinIO) Β· async Β· incremental (base_backup) Β· clickhouse-backup CLI ref | single (m7-) |
8123, 9000, 9100/9101 (MinIO) |
| 8 | Replica/shard/ZK kill, replica disk-loss rebuild Β· insert_quorum drill Β· BACKUP-RESTORE recovery Β· multi-DC sketch | cluster (m8-) |
8123-8128, 9000-9005 |
| 9 | Kafka engine + MV pipeline Β· DLQ via handle_error_mode=stream Β· Replacing exactly-once Β· offset reset | kafka (m9-) |
8123, 9000, 9092, 8080 (UI) |
Run one module at a time. Most modules bind host port
8123. Tear down with./down.shbefore starting the next module.
Once a module is up, ClickHouse and its companions are reachable on
localhost:
| What | URL / address |
|---|---|
Browser query UI (/play) |
http://localhost:8123/play |
| HTTP API | curl 'http://localhost:8123/?query=SELECT+1' |
| Health probe | http://localhost:8123/ping |
| Native protocol (TCP) | clickhouse-client --host localhost --port 9000 |
| Interactive shell (any module) | docker exec -it m<N>-clickhouse clickhouse-client |
Cluster modules (3, 4, 5, 8) expose every replica:
| Replica | HTTP URL | Native |
|---|---|---|
| s1r1 | http://localhost:8123 | localhost:9000 |
| s1r2 | http://localhost:8124 | localhost:9001 |
| s2r1 | http://localhost:8125 | localhost:9002 |
| s2r2 | http://localhost:8126 | localhost:9003 |
| s3r1 | http://localhost:8127 | localhost:9004 |
| s3r2 | http://localhost:8128 | localhost:9005 |
docker exec -it m3-s1r1 clickhouse-client # any cluster moduleModule 7 also exposes the MinIO console:
http://localhost:9101 (login minioadmin / minioadmin).
Module 9 also exposes the Kafka UI: http://localhost:8080,
broker bootstrap from the host: localhost:9092.
See code-examples/demos/README.md for the full module map.
open index.html # or double-click in Finder/ExplorerTheory, diagrams, examples, and templates per module.
ls notion-guides/ # one .md per module, 200-500 lines eachConcise, callout-formatted, portable into Notion.
The original "one big stack" compose files still exist:
cd code-examples/docker/
docker compose -f docker-compose-single.yml up -d # single node
docker compose -f docker-compose-cluster.yml up -d # 3Γ2 cluster
docker compose -f docker-compose-kafka.yml up -d # Kafka
docker compose -f docker-compose-migration.yml up -d # MongoDB/MySQL CDC
docker compose -f docker-compose-monitoring.yml up -d # Grafana + PrometheusModule 1: Fundamentals & Architecture (4-6 hours)
- ClickHouse architecture and use cases
- Column-oriented storage concepts
- Differences from traditional RDBMS
- Hardware requirements and installation
Module 2: Table Engines & Data Modeling (6-8 hours)
- MergeTree family engines
- ReplacingMergeTree, SummingMergeTree, AggregatingMergeTree
- Partitioning strategies and keys
- Data types, codecs, and TTL policies
Module 3: Sharding Strategy & Distribution (6-8 hours)
- Distributed table architecture
- Sharding key selection
- Data distribution across shards
- Resharding considerations
Module 4: Replication & High Availability (6-8 hours)
- ReplicatedMergeTree engine
- ClickHouse Keeper architecture
- Multi-replica cluster setup
- Failover handling
Module 5: Full Cluster Deployment (8-10 hours)
- Production cluster topology (3 shards Γ 2 replicas)
- Configuration management
- Security: users, roles, permissions
- SSL/TLS and monitoring setup
Module 6: Query Optimization & Performance (6-8 hours)
- Query execution pipeline
- Index utilization strategies
- Materialized views
- JOIN optimization
Module 7: Backup, Recovery & PITR (4-6 hours)
- Full vs incremental backups
- Point-in-Time Recovery
- Restore procedures
- Backup automation
Module 8: Disaster Recovery & Business Continuity (4-6 hours)
- DR strategy and RTO/RPO planning
- Multi-datacenter setups
- Failover/failback procedures
- Geo-replication
Module 9: Kafka-Based Real-Time Ingestion (6-8 hours)
- Kafka Engine fundamentals
- Materialized views with Kafka
- Message format handling (JSON, Avro, Protobuf)
- Performance optimization
Module 10: Migration from MongoDB/MySQL (10-14 hours)
- Schema mapping strategies
- Debezium CDC setup
- Historical + live streaming
- Data validation and cutover
Reference XML configs in code-examples/configs/ β useful for copying into a
real ClickHouse installation, not for the demos (those have their own
configs in code-examples/demos/module-*/configs/).
| File | Purpose |
|---|---|
config.xml |
Main server config: ports, memory, cluster, ZK, compression. |
users.xml |
Users, quotas, network restrictions, password hashing. |
metrika.xml |
ZooKeeper / Keeper config. |
keeper_config.xml |
ClickHouse Keeper config. |
macros.xml |
Replication macros (per-node identity). |
sudo cp code-examples/configs/config.xml /etc/clickhouse-server/
sudo cp code-examples/configs/users.xml /etc/clickhouse-server/
sudo systemctl restart clickhouse-servercode-examples/sql/module-N/ contains module-specific .sql files you can
run directly against any ClickHouse instance:
clickhouse-client --multiquery < code-examples/sql/module-1/01-basic-tables.sqlai-changes-md/ holds the AI-generated summary docs and one-shot fix
scripts that produced this curriculum (Notion sync, HTML cleanups, etc.).
Kept for traceability; not needed to use the course.
Focus on deployment, monitoring, and operations:
- Module 1 (Fundamentals)
- Module 5 (Cluster Deployment)
- Module 4 (Replication & HA)
- Module 7 (Backup & Recovery)
- Module 8 (Disaster Recovery)
Focus on data modeling, ingestion, and optimization:
- Module 1 (Fundamentals)
- Module 2 (Table Engines)
- Module 9 (Kafka Ingestion)
- Module 6 (Query Optimization)
- Module 10 (Migration)
Complete comprehensive path:
- Follow all 10 modules sequentially
- Complete all code examples
- Deploy all Docker environments
- Build production-grade solutions
β Architecture & Fundamentals
- Column-oriented storage principles
- MergeTree engine family
- When to use ClickHouse vs other databases
β Data Modeling
- Schema design for analytical workloads
- Partitioning and primary key strategies
- Specialized engines (Replacing, Summing, Aggregating)
β Distributed Systems
- Sharding strategies and key selection
- Multi-replica replication
- Distributed query execution
β Production Operations
- Cluster deployment and configuration
- Security and user management
- Backup, recovery, and disaster recovery
β Performance Optimization
- Query optimization techniques
- Index strategies
- Materialized views
β Real-World Integration
- Kafka-based real-time ingestion
- Migration from MongoDB/MySQL
- Production deployment patterns
- Start with index.html - Get an overview of all modules
- Follow modules sequentially - Each builds on previous knowledge
- Run the code examples - Practice with real SQL
- Deploy Docker environments - Get hands-on experience
- Use Notion guides - Quick reference when needed
-
Session Structure:
- 30 min: Theory (HTML module)
- 60 min: Hands-on practice (SQL examples)
- 30 min: Deploy and test (Docker)
- 30 min: Q&A and exercises
-
Homework Assignments:
- Read next module's Notion guide
- Complete practice exercises
- Deploy relevant Docker environment
-
Assessments:
- Module quizzes (create based on content)
- Hands-on lab exercises
- Final project: Build production cluster
- Basic SQL (SELECT, INSERT, JOIN)
- Command line basics (bash, terminal)
- Understanding of databases (tables, indexes)
- Linux system administration
- Docker basics
- Distributed systems concepts
- Docker & Docker Compose (for hands-on)
- Web browser (for HTML modules)
- Text editor (for Notion guides)
- (Optional) ClickHouse installed locally
After completing this course, you'll be able to:
- Deploy production ClickHouse clusters
- Handle billions of rows with sub-second queries
- Achieve 100-1000x faster queries than traditional RDBMS
- Implement real-time analytics with Kafka streaming
- Migrate terabytes of data from MongoDB/MySQL
- Design highly available multi-datacenter setups
- Optimize queries for 10-100x compression ratios
This is a training curriculum. If you find errors or have improvements:
- Note the module and section
- Suggest improvements with examples
- Test changes with provided Docker environments
This training material is provided for educational purposes.
- Official Documentation: https://clickhouse.com/docs
- ClickHouse Blog: https://clickhouse.com/blog
- GitHub: https://github.com/ClickHouse/ClickHouse
- Slack Community: https://clickhouse.com/slack
- Stack Overflow: Tagged with
clickhouse
This comprehensive training series was designed to provide a complete learning path for ClickHouse, from fundamentals to advanced production scenarios. Each module includes:
- Theory: Comprehensive explanations with diagrams
- Practice: Production-ready code examples
- Templates: Copy-paste solutions for common scenarios
- Best Practices: Industry-standard patterns
- Real-World Cases: Proven solutions from production
Ready to start? Open index.html and begin your ClickHouse journey!
π Happy Learning! π