Skip to main content

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.
To create a dedicated ClickHouse user and grant privileges to the required tables for replication, do the following:
You may restrict access to specific tables instead of the entire database.
Ensure that the ClickHouse user allotted to Zenskar has read-only access.

Set up a ClickHouse data-source connector via Zenskar dashboard

  1. Log into your Zenskar dashboard.
  2. In the left side bar, click Usage > Data Sources.
  3. In the top-right corner, click + ADD DATA SOURCE.
  4. On the Add New Data Source page, configure the connector.
  5. Click on the SAVE SOURCE button.

Configure the connector

General configuration

Connector configuration

You must complete the corresponding conditional table below based on the SSH Tunnel Method you choose.

SSH key authentication configuration

These fields are required only if SSH Tunnel Method is set to SSH Key Authentication.

SSH password authentication configuration

These fields are required only if SSH Tunnel Method is set to Password Authentication.

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.

ClickHouse-specific connector configuration: No tunnel

The connector_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:
This creates:
  • zenskar_bastion_key (private key)
  • zenskar_bastion_key.pub (public key)

Install the public key on the bastion server

Add the public key to the authorized_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.