How Zenifra ClickHouse works
This page shows how Zenifra managed ClickHouse is configured: how many instances each plan uses, how data is replicated, how the connection is protected, and what the application user can do. To create and connect, see Getting started with ClickHouse and Connections and clients.
Summary
| Item | How it is |
|---|---|
| Version | 26.8 (26.8.36.3) |
| Engine | Official ClickHouse, no fork |
| Tables | ReplicatedMergeTree by default in the app database |
| Instances | 1 or 3, depending on the plan, always 1 shard |
| Coordination | ClickHouse Keeper with 3 instances |
| Memory and CPU | reserved per instance, at the plan values |
| Public ports | two, both with TLS: Native TLS and HTTPS |
| User | app, with the app database, no administrative access |
| System logs | system.query_log for 7 days; the others for 3 days |
| Backups | automatic, every 8 to 24 hours, depending on the plan |
| Plans | analytics-sandbox, analytics-starter, analytics-production, and analytics-enterprise |
Version
Every new ClickHouse uses version 26.8 (26.8.36.3), from the official ClickHouse image.
To check your database version:
SELECT version();Instances, CPU, and memory per plan
The values below apply to each instance. The plan CPU and memory are reserved for the instance and are not shared with other projects.
| Plan | Instances | vCPU per instance | Memory per instance |
|---|---|---|---|
analytics-sandbox | 1 | 1 | 2 GiB |
analytics-starter | 1 | 4 | 16 GiB |
analytics-production | 3 | 2 | 8 GiB |
analytics-enterprise | 3 | 4 | 16 GiB |
- The number of instances follows the plan. To go from 1 to 3 instances, or from 3 to 1, change the plan. See Changing plans.
- Every ClickHouse has 1 shard. In 3-instance plans, each instance is a full replica of the data.
- Each instance has its own disk, at the size you chose. Included storage and billing are in Analytics plans.
- Console metrics are available from
analytics-starterup.
Memory and queries
- The plan memory is the ceiling of each instance. Queries, merges, and caches share that space.
- Queries with large
GROUP BYorJOINuse more memory. Filter by time range and by the sorting key to read less data. - Server parameters are managed by Zenifra and follow the plan. What can be tuned per query, with
SETTINGSorSET, is up to you.
To check the memory limits of your instance and your session:
SELECT name, value FROM system.server_settings WHERE name LIKE 'max_server_memory_usage%';
SELECT getSetting('max_memory_usage');Tables, parts, and inserts
- The
appdatabase is created with theReplicatedengine: aCREATE TABLE,ALTER, orDROPrun on one instance is applied to the others. - Without
ENGINEinCREATE TABLE, theappuser creates the table withReplicatedMergeTree. To pick the engine, use aReplicated*variant, such asReplicatedReplacingMergeTree. - Each
INSERTwrites a new part of the table. In the background, ClickHouse combines smaller parts into larger ones (merge). - Send inserts in batches, with thousands of rows at a time, not one row per
INSERT. Many small inserts create many parts and slow the table down. - Tables with non-replicated engines, such as
MergeTree,Memory, orLog, keep their data only on the instance that received the insert.
Replication and high availability
- In 3-instance plans, every replica accepts reads and writes. An insert received by one replica is copied to the others.
- Coordination between replicas uses ClickHouse Keeper, with 3 instances on different servers. Each project has its own space in Keeper.
- The 3 instances of a ClickHouse always run on different servers, close to each other on the network, so that a server failure does not take down all replicas together.
- Each instance disk is replicated in storage. If a server goes down, the instance comes back on another server with the same data.
- When changing to a 1-instance plan, Zenifra first checks that the replicas are in sync and that there is no data in non-replicated tables. If there is, the change is refused with a message that says what to do.
Failover
- The public address only leads to instances that respond. Each instance is checked every 5 seconds.
- In 3-instance plans, if a replica fails, new connections go to the others, with no action from you. The host and ports in the console do not change.
- Open connections to the failed instance drop. Configure your application to reconnect and retry idempotent inserts and queries.
- In 1-instance plans, the instance restarts automatically, on the same server or on another one, with the same data.
Encryption and TLS
- Public ports: each project gets two ports, both with TLS: Native TLS, for
clickhouse-clientand native drivers, and HTTPS, for JDBC, DBeaver, and HTTP clients. The port numbers are shown in the console. See Connections and clients. - Private connections between applications: also use TLS, on ports
9440(Native TLS) and8443(HTTPS). See Private connections between applications. - Public certificate: the host is
clickhouse-<id>.managed.zenifra.com, with a certificate validated by the system authorities, no certificate file needed. Always connect through the console host, not the IP. - At rest: ClickHouse data disks are encrypted.
User and permissions
- The application user is
app, with theappdatabase. The password is stored as a SHA-256 hash and can be changed in the console. See Operations and troubleshooting. - In the
appdatabase, theappuser has:SELECT,INSERT,CREATE TABLE,CREATE VIEW,ALTER,DROP TABLE,DROP VIEW, andTRUNCATE. - Server administration (parameters, users, replication, backups, and versions) is handled by Zenifra.
System logs
ClickHouse keeps query and event history in tables of the system database. Zenifra sets how long each one is kept:
| Table | Retention |
|---|---|
system.query_log | 7 days |
system.part_log, system.text_log, system.metric_log, system.asynchronous_metric_log, system.query_metric_log, system.query_views_log, system.error_log | 3 days |
system.text_logkeeps messages from thewarninglevel up.
To see the slowest queries in the last hour:
SELECT query_duration_ms, read_rows, memory_usage, query
FROM system.query_log
WHERE type = 'QueryFinish' AND event_time > now() - INTERVAL 1 HOUR
ORDER BY query_duration_ms DESC
LIMIT 10;Backups
Backups are automatic and included in the plan:
| Plan | Frequency | Retention |
|---|---|---|
analytics-sandbox | every 24 hours | 3 days |
analytics-starter | every 24 hours | 7 days |
analytics-production | every 12 hours | 14 days |
analytics-enterprise | every 8 hours | 30 days |
See Automatic backups.
Next steps
Last updated on
Analytics on Zenifra
Zenifra Analytics offers managed ClickHouse for events, time series and dashboards. Follow the path: creation, plans, client connections and operations.
Getting started with ClickHouse
Create a managed ClickHouse project in Zenifra Analytics, save the password shown only once, connect a client and run CREATE TABLE, INSERT and SELECT queries.