Overview
ClickHouse is a high-performance, column-oriented OLAP database designed for real-time analytics at scale. In Zenskar, you can use ClickHouse as a data source to stream and process event data for metering, billable metrics, and analytical dashboards.Prerequisites
General
- ClickHouse version 21.3.10.1 or later.
- Allow Zenskar to connect to your ClickHouse instance, with SSH tunnel configuration, if required.
Create a dedicated read-only user in ClickHouse (recommended)
To create a dedicated ClickHouse user and grant privileges to the required tables for replication, do the following:Set up a ClickHouse data-source connector via Zenskar dashboard
- Log into your Zenskar dashboard.
- In the left side bar, click Usage > Data Sources.
- In the top-right corner, click + ADD DATA SOURCE.
- On the Add New Data Source page, configure the connector.
- Click on the SAVE SOURCE button.
Configure the connector
General configuration
Connector configuration
SSH key authentication configuration
SSH password authentication configuration
Data source access mode (read-only)
Zenskar replicates data directly from the source to Zenskar’s data infrastructure. The data is periodically synced to maintain freshness. This option is:- Ideal for small-mid size database (less than 30 GB)
- Ideal for periodical data ingestion
- Optimized for quicker invoice generation
Set up a ClickHouse data-source connector via API
Refer to the create data-source connector API reference.
The
connector_config object is the only part of the request that differs across connector types (such as BigQuery, Snowflake, or Redshift). The create data-source connector API reference provides a generic overview, while this document explains the ClickHouse-specific structure of connector_config.Request examples
The API request payload depends on the SSH Tunnel Method. The following three tabs exemplify the available options: 1) No Tunnel; 2) SSH Key Authentication; 3) Password Authentication.- No tunnel
- SSH key authentication
- SSH password authentication
ClickHouse-specific connector configuration: No tunnel
Theconnector_config object contains configuration fields specific to the ClickHouse data source.Addendum
SSH key setup
When using SSH key authentication, you will generate a key pair that contains:
This setup lets Zenskar securely connect to your bastion host without a password.
Generate the key pair
Run the following command to generate a PEM-formatted RSA key pair:zenskar_bastion_key(private key)zenskar_bastion_key.pub(public key)
Install the public key on the bastion server
Add the public key to theauthorized_keys file for the SSH user:
This must be done for the same Linux user that you will configure as the SSH Login Username in Zenskar.
Notes
The simplest way to verify connectivity is to configure the data source in the Zenskar UI.
SSH credentials and ClickHouse database credentials are separate.