This repository contains a ClickHouse lab for learning and testing purposes.
Before getting started, ensure you have installed:
Note
Mise is optional but highly recommended because some helpers commands and environment variables are managed through it for ease of management.
First, you need to install the required tools via mise:
mise installOnce the prerequisites are installed, you can simply launch the environment provisioning:
mise startFinally, you can access the ClickHouse via CLI or the embedded SQL console:
-
CLI (ClickHouse Client)
mise client
-
Embedded SQL console
mise sql
In the datasets folder, there are SQL scripts to load various public datasets referenced on the ClickHouse website.
To import a dataset, simply run the mise load-dataset task with the name of the file without the .sql suffix:
mise load-dataset cell-towers
mise load-dataset ontimeNote
The available datasets are hardcoded in the Mise task to simplify the process (pro-tip: use tab completion to choose a dataset).
ClickHouse can be integrated with external systems such as object storage, event streaming platforms (e.g Kafka), or databases (e.g PostgreSQL, MySQL or MongoDB).
In this lab, some of these systems can be optionally enabled with --enable-<integration> flags if available:
$ mise start --help
Start stack
Usage: start [--enable-pg]
Flags:
--enable-pg Enable PostgreSQL integration
# Enable PostgreSQL integration
mise start --enable-pgStack services versions are managed in the mise.toml file in the env section. These variables are loaded directly in shell environment variables by Mise once entering the stack folder.
[env]
CLICKHOUSE_VERSION = "26.9.8.3"
POSTGRESQL_VERSION = "18.6"All common operations are wrapped in Mise tasks to provide a consistent and convenient interface instead of memorizing long docker-compose or clickhouse commands.
Stack management
start- Start stackstop- Stop stackclean- Clean all stack resources (services, volumes, networks)reset- Reset stack from scratchlogs- Get logs from a given stack service
Datasets management
load-dataset- Load sample dataset into ClickHouse
Misc
client- Connect to ClickHouse using CLI client (alias:cli)dashboard- Open embedded ClickHouse dashboard in browser (alias:dash)sql- Open embedded ClickHouse SQL console in browser