ClickHouse Keeper
ClickHouse Keeper is a full-featured replacement for Apache ZooKeeper, developed specifically to coordinate and manage ClickHouse® clusters. It ensures full compatibility with the ZooKeeper client protocol and uses the same data model, while offering major improvements in performance and functionality.
Simplified installation and operation
- Implemented in C++ instead of Java for more efficient resource utilization.
- Can operate either embedded into ClickHouse® or as a standalone service.
- Uses less memory than ZooKeeper for the same data volume.
Optimized data storage
- Snapshots and logs take up much less disk space due to improved compression.
- No default packet size or node data size limits, versus ZooKeeper’s 1 MB limit.
- No ZXID overflow problem that requires ZooKeeper to restart every 2 billion transactions.
Enhanced performance and reliability
- Faster post-network segmentation recovery thanks to an improved distributed consensus protocol.
- Extra consistency guarantees. Ensures the same consistency guarantees as ZooKeeper: linearizable writes and strict operation order within a single session.
- Optional linearizable reads via the
quorum_readssetting.
Core coordination features
ClickHouse Keeper performs critical functions in the ClickHouse® ecosystem:
- Provides a coordination system for data replication in self-managed ClickHouse® clusters.
- Automatically deduplicates inserts for replicated MergeTree-family tables using block hash checksums.
- Provides consensus with regard to part names, assignment of part merges and mutations to particular cluster nodes.
- Enables the KeeperMap table engine, which allows using Keeper as a consistent key-value store.
- Tracks processed files in the S3Queue table engine.
- Stores all Replicated Database metadata.
- Coordinates the creation of backups via the ON CLUSTER clause.
- Serves as a repository for user-defined functions and access control data.
- Operates as the central storage of all ClickHouse Cloud’s metadata.
ClickHouse Keeper is a robust and efficient coordination solution for distributed systems, purpose-built and optimized for ClickHouse®.
-
Create a cloud network and a subnet to host the virtual machine (VM).
-
Create a security group for the VM named
vm-keeperin your new cloud network and configure the rules as follows:Traffic direction Description Port range Protocol Source / Destination CIDR blocks IngressCH Keeper9181TCPCIDR0.0.0.0/0IngressSSH22TCPCIDR0.0.0.0/0EgressAny Egress0-65535AnyCIDR0.0.0.0/0 -
Create a security group for the VM named
vm-testin the same network and configure the rules as follows:Traffic direction Description Port range Protocol Source / Destination CIDR blocks IngressHTTP80TCPCIDR0.0.0.0/0IngressSSH22TCPCIDR0.0.0.0/0EgressAny Egress0-65535AnyCIDR0.0.0.0/0 -
Get an SSH key pair for connection to the VM.
-
Install and configure the application.
-
In our Marketplace, find ClickHouse Keeper and click Create VM.
-
Under Network settings, specify the earlier-created cloud network, subnet, and security group for
vm-keeper. -
Under Access, specify the username and public SSH key for connection to the VM.
-
Under General information, specify the VM name:
vm-keeper. -
Complete setting up your VM and click Create VM.
Wait for the VM to be created and the application to be installed: this may take up to 10 minutes.
-
-
Learn the public IP address of
vm-keeper. -
Connect to
vm-keeperover SSH. Use the username you set when creating the VM and the private SSH key you created earlier. -
Add the following to
/etc/clickhouse-keeper/keeper_config.xmlright after the<clickhouse>line:<listen_host>0.0.0.0</listen_host>The
0.0.0.0address is not recommended in production environments. -
Check that ClickHouse Keeper is running:
sudo systemctl status clickhouse-keeperResult:
● clickhouse-keeper.service - ClickHouse Keeper - zookeeper compatible distributed coordination server Loaded: loaded (/usr/lib/systemd/system/clickhouse-keeper.service; enabled; preset: enabled) Active: active (running) since Wed 2026-03-04 19:15:51 UTC; 17min ago ...If your ClickHouse Keeper is not running, start it manually using this command:
sudo systemctl start clickhouse-keeper
-
-
Create and configure a VM to test ClickHouse Keeper operation.
-
When creating the VM, specify the following:
- Under Boot disk image on the Marketplace tab, select an Ubuntu or Debian image, e.g.,
Ubuntu 24.04. - Under Network settings, specify the earlier created cloud network, subnet, and security group for
vm-test. - Under Access, specify the username and public SSH key for connection to the VM.
- Under General information, specify the VM name:
vm-test.
- Under Boot disk image on the Marketplace tab, select an Ubuntu or Debian image, e.g.,
-
Learn the public IP address of
vm-test. -
Connect to
vm-testover SSH. Use the username you set when creating the VM and the private SSH key you created earlier. -
Install ClickHouse Server and ClickHouse Client as detailed in Install ClickHouse on Debian/Ubuntu.
-
Create a file named
/etc/clickhouse-server/config.d/zookeeper.xmland paste the following code into it:<clickhouse> <zookeeper> <node> <host>VM_public_IP_address</host> <port>9181</port> </node> </zookeeper> </clickhouse>In the
hostfield, specifyvm-keeper's public IP address. -
Start a server by running this command:
sudo systemctl start clickhouse-server -
Enable the SQL query execute mode by running this command:
clickhouse-client -
Run this query:
SELECT hostname() AS clickhouse_server, zookeeperSessionUptime() AS keeper_session_secondsResult:
Query id: 040b6642-faf0-4a2b-9c79-50bb******** ┌─clickhouse_server─┬─keeper_session_seconds─┐ 1. │ vm-test │ 158 │ └───────────────────┴────────────────────────┘ 1 row in set. Elapsed: 0.002 sec.
-
-
Check your connection.
-
Connect to
vm-keeperover SSH. -
Run this command:
sudo ss -anp | grep :9181Result:
tcp LISTEN 0 64 *:9181 *:* users:(("clickhouse-keep",pid=806,fd=42)) tcp ESTAB 0 0 [::ffff:10.0.0.30]:9181 [::ffff:62.**.***.***]:58646 users:(("clickhouse-keep",pid=806,fd=37))If the command is successful, your ClickHouse Server on
vm-testis connected to ClickHouse Keeper onvm-keeper.
-
- Coordinating data replication in ClickHouse® clusters.
- Automatic deduplication of inserts for replicated MergeTree tables.
- Implementing task queues using the KeeperMap table engine.
- Exactly-once delivery in Kafka Connect Sink.
- Tracking processed files in S3Queue.
- Storing Replicated Database metadata.
- Coordinating the creation of cluster backups.
- Storing user-defined functions and access control settings.
- Central metadata storage for ClickHouse Cloud.
Yandex Cloud technical support is available 24/7. The types of requests you can submit and the relevant response times depend on your pricing plan. You can switch to the paid support plan in the management console. You can learn more about the technical support terms and conditions here.