feat: with clickhouse

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
Kasper Juul Hermansen 2024-08-05 22:24:11 +02:00
parent f8ef7701ea
commit a0be74c4d8
Signed by: kjuulh
GPG Key ID: D85D7535F18F35FA
2 changed files with 55 additions and 0 deletions

View File

@ -0,0 +1,12 @@
CREATE SINK click_stats
FROM
m_click_statistic WITH (
connector = 'clickhouse',
type = 'append-only',
force_append_only='true',
clickhouse.url = 'http://clickhouse-server-1:8123',
clickhouse.user = 'default',
clickhouse.password = '',
clickhouse.database = 'default',
clickhouse.table='click_stats',
);

View File

@ -0,0 +1,43 @@
services:
clickhouse-server:
image: clickhouse/clickhouse-server:24-alpine
container_name: clickhouse-server-1
hostname: clickhouse-server-1
ports:
- "8123:8123"
- "9000:9000"
- "9004:9004"
expose:
- 8123
- 9009
configs:
- source: clickhouse_init
target: /docker-entrypoint-initdb.d/init-db.sh
clickhouse-ui:
image: "ghcr.io/caioricciuti/ch-ui:latest"
ports:
- 5521:5521
environment:
- VITE_CLICKHOUSE_URL=http://localhost:8123
- VITE_CLICKHOUSE_USER=default
#- VITE_CLICKHOUSE_PASS=default
depends_on:
- clickhouse-server
configs:
clickhouse_init:
content: |
#!/bin/bash
set -e
clickhouse client -n <<-EOSQL
CREATE table click_stats(
clicks_count Int64,
ad_id Int64
)ENGINE = ReplacingMergeTree
PRIMARY KEY (ad_id);
EOSQL