Go: introduce clickhouse (#16996)

### Summary

Introduce Clickhouse for data statistics.

Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
Jin Hai
2026-07-16 18:36:56 +08:00
committed by GitHub
parent caa76fb68e
commit c7a623ff81
11 changed files with 297 additions and 26 deletions

View File

@@ -148,6 +148,19 @@ REDIS_PASSWORD=infini_rag_flow
NATS_HOST=nats
NATS_PORT=4222
# The hostname where the ClickHouse service is exposed
CLICKHOUSE_HOST=clickhouse
# The port used to expose the ClickHouse native TCP service
CLICKHOUSE_TCP_PORT=9900
# The port used to expose the ClickHouse HTTP service
CLICKHOUSE_HTTP_PORT=8123
# The username for ClickHouse
CLICKHOUSE_USER=ragflow
# The password for ClickHouse
CLICKHOUSE_PASSWORD=infini_rag_flow
# The database for ClickHouse
CLICKHOUSE_DATABASE=ragflow
# Jaeger (distributed tracing)
# Enable by adding `jaeger` to COMPOSE_PROFILES, e.g.:
# COMPOSE_PROFILES=${COMPOSE_PROFILES},jaeger

View File

@@ -342,6 +342,37 @@ services:
restart: unless-stopped
clickhouse:
profiles:
- clickhouse
image: clickhouse/clickhouse-server:26.5.5.8
volumes:
- clickhouse_data:/var/lib/clickhouse
- ./init-clickhouse.sql:/docker-entrypoint-initdb.d/init.sql
ports:
- ${CLICKHOUSE_TCP_PORT:-9900}:9000
- ${CLICKHOUSE_HTTP_PORT:-8123}:8123
env_file: .env
environment:
- CLICKHOUSE_USER=${CLICKHOUSE_USER:-ragflow}
- CLICKHOUSE_PASSWORD=${CLICKHOUSE_PASSWORD:-infini_rag_flow}
- CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT=1
mem_limit: ${MEM_LIMIT}
ulimits:
nofile:
soft: 655350
hard: 655350
healthcheck:
test: ["CMD", "clickhouse-client", "--user", "${CLICKHOUSE_USER:-ragflow}", "--password", "${CLICKHOUSE_PASSWORD:-infini_rag_flow}", "-q", "SELECT 1"]
interval: 10s
timeout: 10s
retries: 30
start_period: 30s
networks:
- ragflow
restart: unless-stopped
volumes:
esdata01:
driver: local
@@ -365,6 +396,8 @@ volumes:
driver: local
nats_data:
driver: local
clickhouse_data:
driver: local
networks:
ragflow:

View File

@@ -0,0 +1 @@
CREATE DATABASE IF NOT EXISTS ragflow;

View File

@@ -63,6 +63,12 @@ redis:
nats:
host: ${NATS_HOST:-0.0.0.0}
port: ${NATS_PORT:-4222}
clickhouse:
host: '${CLICKHOUSE_HOST:-clickhouse}'
port: ${CLICKHOUSE_TCP_PORT:-9000}
user: '${CLICKHOUSE_USER:-ragflow}'
password: '${CLICKHOUSE_PASSWORD:-infini_rag_flow}'
database: '${CLICKHOUSE_DATABASE:-ragflow}'
otel:
host: ${OTEL_HOST:-0.0.0.0}
port: ${OTEL_PORT:-4318}