summaryrefslogtreecommitdiff
path: root/docs/operations/setup-clickhouse.md
blob: acc8247ac592bb6f65bfa139a0b9264c86d9ca6c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Setup: ClickHouse

ClickHouse is only used in **watch mode**. Epimetheus creates the metrics table automatically if it does not exist.

## Running ClickHouse

- **Linux (systemd):** `sudo systemctl start clickhouse-server`
- **Docker:** Use the official [ClickHouse image](https://hub.docker.com/r/clickhouse/clickhouse-server) and expose the HTTP interface (default port 8123).
- **Kubernetes:** Deploy ClickHouse and expose a Service; use the HTTP URL (e.g. `http://clickhouse.monitoring.svc.cluster.local:8123`) as `-clickhouse`.

Default HTTP port is **8123**. Epimetheus uses the HTTP interface, not the native protocol.

## Table Creation

You do not need to create the table manually. On first ingest, Epimetheus runs:

```sql
CREATE TABLE IF NOT EXISTS epimetheus_metrics (
    metric String,
    labels Map(String, String),
    value Float64,
    timestamp DateTime64(3)
) ENGINE = MergeTree()
ORDER BY (metric, timestamp)
```

To use a different table name, set `-clickhouse-table`.

## Verification

After running watch mode with `-clickhouse` set, verify ingestion:

```bash
./scripts/verify-clickhouse.sh
```

With custom URL or table:

```bash
./scripts/verify-clickhouse.sh http://localhost:8123 epimetheus_metrics
```

The script checks connectivity (`/ping`), row count, distinct metrics, sample rows, and rows per metric. If the table is empty or missing, it prints a reminder command to run Epimetheus in watch mode with `-clickhouse`. See [ClickHouse backend](../backends/clickhouse.md) for usage.