ClickHouse Configuration
ClickHouse serves as the primary analytics database for storing profiling data and metrics. It provides high-performance columnar storage optimized for analytical queries.
Configuration Modes​
- Use Existing
- Create Mode
Connect to existing ClickHouse​
This mode connects to your existing ClickHouse cluster, including ClickHouse Cloud, on-premises clusters, and single-node instances.
Supported ClickHouse Deployments
- ClickHouse Cloud: Managed ClickHouse service with automatic scaling and management
- ClickHouse Clusters: Multi-node distributed setups with shards and replicas
- Single-node ClickHouse: Standalone ClickHouse server installations
Database Setup Options​
You have two options for setting up the required databases:
- Manual Setup: Create databases and users manually using SQL commands.
- Automatic Setup: Enable
autoCreateDBs
to let zymtrace create databases during migration
Option 1: Manual Database Setup​
When connecting to an existing ClickHouse cluster, we strongly recommend that you create a dedicated user, assign appropriate permissions, and create a new database for zymtrace
.
If you're using a distributed ClickHouse cluster with multiple shards/replicas, you have two options:
- Use the
{cluster}
macro (recommended): A common convention where{cluster}
is configured as a macro that resolves to your cluster name - Find the actual cluster name: Query your ClickHouse installation to get the specific cluster name
-- Check if the {cluster} macro is available
SELECT * FROM system.macros;
-- Find available clusters in your ClickHouse installation
SELECT cluster FROM system.clusters;
SQL Commands for Database Setup​
Choose the appropriate commands based on your ClickHouse deployment.
This script will drop the zymtrace_profiling
database if it exists. Run it only if this is your first time setting up zymtrace with ClickHouse, or if you intentionally want to reset the database, knowing that this will permanently delete any existing data.
- ClickHouse Cloud / Single Node
- ClickHouse Cluster
ClickHouse Cloud and Single Node​
For single-node ClickHouse installations or ClickHouse Cloud:
-- Clean slate: remove any existing profiling database
DROP DATABASE IF EXISTS zymtrace_profiling SYNC;
DROP DATABASE IF EXISTS zymtrace_metrics SYNC;
CREATE DATABASE zymtrace_profiling;
CREATE DATABASE zymtrace_metrics;
CREATE USER IF NOT EXISTS zymtrace_user
IDENTIFIED WITH sha256_password BY 'YOUR NEW PASSWORD HERE';
GRANT
SELECT,
INSERT,
UPDATE,
ALTER,
DELETE,
CREATE,
DROP,
SHOW,
OPTIMIZE,
TRUNCATE
ON zymtrace_profiling.* TO zymtrace_user;
GRANT
SELECT,
INSERT,
UPDATE,
ALTER,
DELETE,
CREATE,
DROP,
SHOW,
OPTIMIZE,
TRUNCATE
ON zymtrace_metrics.* TO zymtrace_user;
Distributed ClickHouse Cluster Setup​
For ClickHouse clusters with multiple shards/replicas, you can use either the {cluster}
macro or specify the actual cluster name:
Using the {cluster}
macro (recommended)
-- Clean slate: remove any existing profiling database
DROP DATABASE IF EXISTS zymtrace_profiling ON CLUSTER '{cluster}' SYNC;
DROP DATABASE IF EXISTS zymtrace_metrics ON CLUSTER '{cluster}' SYNC;
CREATE DATABASE zymtrace_profiling ON CLUSTER '{cluster}';
CREATE DATABASE zymtrace_metrics ON CLUSTER '{cluster}';
CREATE USER IF NOT EXISTS zymtrace_user ON CLUSTER '{cluster}'
IDENTIFIED WITH sha256_password BY 'YOUR NEW PASSWORD HERE';
GRANT ON CLUSTER '{cluster}'
SELECT,
INSERT,
UPDATE,
ALTER,
DELETE,
CREATE,
DROP,
SHOW,
OPTIMIZE,
TRUNCATE,
SYSTEM SYNC REPLICA
ON zymtrace_profiling.* TO zymtrace_user;
GRANT ON CLUSTER '{cluster}'
SELECT,
INSERT,
UPDATE,
ALTER,
DELETE,
CREATE,
DROP,
SHOW,
OPTIMIZE,
TRUNCATE,
SYSTEM SYNC REPLICA
ON zymtrace_metrics.* TO zymtrace_user;
GRANT ON CLUSTER '{cluster}' REMOTE, CLUSTER ON *.* to zymtrace_user;
Alternative: Using the actual cluster name
Replace your_cluster_name
with your actual cluster name from the system.clusters
query above:
-- Clean slate: remove any existing profiling database
DROP DATABASE IF EXISTS zymtrace_profiling ON CLUSTER your_cluster_name SYNC;
DROP DATABASE IF EXISTS zymtrace_metrics ON CLUSTER your_cluster_name SYNC;
CREATE DATABASE zymtrace_profiling ON CLUSTER your_cluster_name;
CREATE DATABASE zymtrace_metrics ON CLUSTER your_cluster_name;
CREATE USER IF NOT EXISTS zymtrace_user ON CLUSTER your_cluster_name
IDENTIFIED WITH sha256_password BY 'YOUR NEW PASSWORD HERE';
GRANT ON CLUSTER your_cluster_name
SELECT,
INSERT,
UPDATE,
ALTER,
DELETE,
CREATE,
DROP,
SHOW,
OPTIMIZE,
TRUNCATE,
SYSTEM SYNC REPLICA
ON zymtrace_profiling.* TO zymtrace_user;
GRANT ON CLUSTER your_cluster_name
SELECT,
INSERT,
UPDATE,
ALTER,
DELETE,
CREATE,
DROP,
SHOW,
OPTIMIZE,
TRUNCATE,
SYSTEM SYNC REPLICA
ON zymtrace_metrics.* TO zymtrace_user;
GRANT ON CLUSTER your_cluster_name REMOTE, CLUSTER ON *.* to zymtrace_user;
{cluster}
macro: A common naming convention where{cluster}
is configured as a macro that resolves to your cluster name. This approach works across different cluster configurations without hardcoding names.- Actual cluster name: Replace
your_cluster_name
with the actual cluster name from yoursystem.clusters
query. Common examples includeproduction_cluster
,default_cluster
, orch_cluster
.
Make sure to replace YOUR NEW PASSWORD HERE
with a secure password.
Reference - https://clickhouse.com/docs/sql-reference/statements/grant
Option 2: Automatic Database Setup​
Alternatively, you can enable autoCreateDBs: true
in your configuration to let zymtrace automatically create the required databases during migration. This option requires that your ClickHouse user has CREATE permissions on the server.
When to use automatic setup:
- Development environments where quick setup is preferred
- When you have administrative access to grant broad CREATE permissions
- Testing scenarios where database recreation is acceptable
When to use manual setup:
- Production environments requiring strict permission control
- When following security best practices with minimal required permissions
- Enterprise environments with database administration policies
When using ClickHouse Cloud, ensure you use port 8443
and enable secure connection. For ClickHouse clusters, specify the cluster name to enable distributed queries.
Helm Configration​
- ClickHouse Cloud / Single Node
- ClickHouse Cluster
ClickHouse Cloud / Single Node​
This configuration applies to both ClickHouse Cloud and standalone single-node ClickHouse installations.
clickhouse:
mode: "use_existing"
use_existing:
host: "https://abc123def.us-east-1.aws.clickhouse.cloud:8443" # For ClickHouse Cloud,
# OR "http://clickhouse.internal.company.com:8123" # For single-node
user: "default" # For Cloud, or "zymtrace_user" for single-node
password: "your-cloud-password" # For Cloud, or "secure-password" for single-node
database: "zymtrace"
secure: true # For Cloud, or false/true for single-node depending on TLS
# clusterName not needed for Cloud or single-node
# autoCreateDBs: true # or create the DBs yourself using the SQL above
ClickHouse Cluster (On-premises)​
This configuration applies to distributed ClickHouse clusters with multiple nodes, shards, or replicas.
clickhouse:
mode: "use_existing"
use_existing:
host: "https://your-instance.region.provider.clickhouse.cloud:8443" # Complete URL with protocol and port
user: "default" # Your ClickHouse username
password: "your-password" # Your ClickHouse password
database: "zymtrace" # Database prefix - creates zymtrace_profiling and zymtrace_metrics
secure: true # Enable TLS/secure connection (required for ClickHouse Cloud)
clusterName: "" # Optional: ClickHouse cluster name for distributed setups (e.g., "production_cluster").
# Required when using ClickHouse clusters with multiple shards/replicas.
# You can use either the actual cluster name or "{cluster}" macro if configured.
# When enabled, we use the ON CLUSTER macro for distributed queries across cluster nodes.
# Leave empty for ClickHouse Cloud or single-node ClickHouse instances.
autoCreateDBs: false # When true, zymtrace migration will automatically create the required databases.
# NOTE: For autoCreateDBs to work, the database user must have CREATE DATABASE permission.
# Grant with: GRANT CREATE ON *.* TO your_user;
HTTP Interface Requirement​
Only the ClickHouse HTTP interface is supported due to limitations in the official ClickHouse Rust client. The native protocol port is not supported. Always use the HTTP interface port:
- HTTP: Port 8123 (typically for internal/dev environments)
- HTTPS: Port 8443 (recommended for production and ClickHouse Cloud)
URL Format Requirements​
The host
field must include:
- Protocol:
http://
orhttps://
- Hostname/IP: The ClickHouse server address
- Port: The HTTP interface port
Next Steps​
After configuring ClickHouse, proceed to configure the other storage components:
Deploy new ClickHouse instance​
This mode deploys and manages ClickHouse within your cluster.
ClickHouse Create Mode Configuration
clickhouse:
mode: "create"
create:
image:
repository: clickhouse/clickhouse-server
tag: "25.3.2.39"
config:
user: "clickhouse"
password: "clickhouse123"
database: "zymtrace"
service:
http:
port: 8123
native:
port: 9000
replicas: 1
resources:
requests:
cpu: "500m"
memory: "1Gi"
limits:
cpu: "2000m"
memory: "4Gi"
storage:
type: "persistent" # "persistent" or "empty_dir"
size: 30Gi
className: ""