Initial setup to write to ClickHouse
Prerequisites
Before you configure ClickHouse Writer, provision a ClickHouse Cloud service or self-hosted ClickHouse cluster, and create a dedicated ClickHouse user with the permissions ClickHouse Writer needs.
Network requirements
ClickHouse Cloud uses port 8443 for JDBC by default; this port is open by default and network settings are managed by ClickHouse Cloud. For a self-hosted deployment, open the following ports as needed:
Port | Purpose |
|---|---|
8123/tcp | HTTP interface |
9000/tcp | Native interface |
8443/tcp | HTTPS interface |
9440/tcp | TLS interface |
If you use Replicated or Distributed table engines with a self-hosted, clustered ClickHouse deployment, your ClickHouse cluster must also have replication configured, including ClickHouse Keeper (or ZooKeeper) and the interserver HTTP port used for data-part transfer between replicas. See ClickHouse's own clustering documentation for cluster-level configuration; ClickHouse Writer does not configure cluster topology.
Create a ClickHouse user for ClickHouse Writer
Important
ClickHouse Writer does not create the target database. If the mapped database does not exist in ClickHouse, the application halts at startup with an error identifying the missing database. Create the target database yourself before you deploy your application.
Striim recommends creating a dedicated ClickHouse user for ClickHouse Writer rather than using the default administrative user. Grant the user the following permissions on the target database:
GRANT CREATE TABLE ON <database>.* TO <user>; GRANT ALTER TABLE ON <database>.* TO <user>; GRANT DROP TABLE ON <database>.* TO <user>; GRANT TRUNCATE ON <database>.* TO <user>; GRANT CREATE DATABASE ON *.* TO <user>; GRANT SHOW TABLES ON *.* TO <user>; GRANT SHOW DATABASES ON *.* TO <user>; GRANT SELECT ON information_schema.* TO <user>; GRANT SELECT ON system.tables TO <user>; GRANT SELECT ON system.columns TO <user>; GRANT SELECT ON system.parts TO <user>; GRANT SELECT, INSERT, UPDATE, DELETE ON <database>.* TO <user>;
Alternatively, if you want to use X.509 SSL authentication, see Using SSL X.509 authentication for ClickHouse.
Supported database engines
ClickHouse Writer supports the Shared database engine (used by ClickHouse Cloud services) and the Atomic database engine (the default for self-hosted ClickHouse deployments).
Configure TLS or mutual TLS authentication
Connections to ClickHouse Cloud are always encrypted using TLS. For a self-hosted deployment, you can configure TLS separately, and enable it in the Connection Profile using the EnableSSL property.
To use SSL X.509 (mutual TLS) authentication with a self-managed ClickHouse deployment, generate a client certificate and key, and create a matching ClickHouse user:
Generate a key and certificate signing request:
openssl req -newkey rsa:2048 -nodes -subj "/CN=<host>:<user>" \ -keyout <user>_key.key -out <user>.csr
Sign the certificate with your certificate authority:
openssl x509 -req -in <user>.csr -out <user>.crt \ -CA <ca_cert>.crt -CAkey <ca_cert>.key -days 365
The certificate authority here is your organization's own CA — the same one already used to sign your ClickHouse server or VM certificates for encrypted communication. Striim does not provide or require a specific CA; use whichever CA your ClickHouse deployment already trusts.
Create (or convert) the matching ClickHouse user:
CREATE USER <user> IDENTIFIED WITH ssl_certificate CN '<host>:<user>'; -- or, to convert an existing user: ALTER USER <user> IDENTIFIED WITH ssl_certificate CN '<host>:<user>';
The private key must be in PKCS#8 PEM format. In the Connection Profile, set Authentication Type to SslX509 and provide the Username, Client SSL Certificate, Client SSL Key, and CA Certificate. ClickHouse Writer performs mutual TLS: the client authenticates the server, and the server authenticates the client, using TLS v1.3 where the ClickHouse server supports it.
Private network connectivity (AWS PrivateLink)
AWS PrivateLink lets Striim connect to a ClickHouse Cloud service over private networking instead of a public endpoint. This feature is available only on ClickHouse Cloud's Scale and Enterprise plans. Cross-region PrivateLink is also supported, across a broad set of AWS regions; AWS charges separately for cross-region data transfer. If PrivateLink is already configured for another service in your organization, ClickHouse Cloud can often reuse the same endpoint within a region (this is not guaranteed across different ClickHouse organizations).
Set up the private endpoint
In the ClickHouse Cloud console, open the service's Settings page and note both the Service name and the DNS name.
In the AWS console, go to VPC > Endpoints > Create endpoint, choose "Endpoint services that use NLBs and GWLBs," and paste in the Service name. If AWS reports "Service name couldn't be verified," contact ClickHouse Cloud support to enable your region. For a cross-region connection, enable the cross-region endpoint option and specify the region where the ClickHouse service runs.
Select your VPC and subnets, and assign a security group that allows inbound access on ports 443, 8443, 9440, and 3306.
Enable "Private DNS names" on the VPC endpoint during creation. This has AWS automatically create a Route 53 private hosted zone with a wildcard record that resolves the ClickHouse private endpoint hostname to private IP addresses inside your VPC.
Note the endpoint ID once the VPC endpoint is created.
Back in the ClickHouse Cloud console, open the service's Settings page, click "Set up private endpoint," and add the AWS endpoint ID to the service's allow list.
Configure the connection
ClickHouse Cloud issues a public JDBC URL such as jdbc:clickhouse://<cluster-id>.<region>.aws.clickhouse.cloud:8443. Rather than changing the Connection Profile to point at the PrivateLink-specific hostname, the recommended approach is to leave the Connection URL exactly as ClickHouse Cloud provided it, and let DNS resolve it privately from inside your VPC:
Create a Route 53 Private Hosted Zone for the aws.clickhouse.cloud domain and associate it with your VPC.
In that hosted zone, add a CNAME record mapping the public hostname (<cluster-id>.<region>.aws.clickhouse.cloud) to the PrivateLink hostname (<cluster-id>.<region>.vpce.aws.clickhouse.cloud).
With this in place, anything inside the VPC that resolves the original public hostname is transparently redirected to the private endpoint, while the same hostname still resolves to ClickHouse's public IP addresses from outside the VPC. Your Connection Profile's Connection URL does not need to change.
Verify the private connection
From an EC2 instance inside the VPC where the private hosted zone is associated:
Run dig +short <cluster-id>.<region>.aws.clickhouse.cloud. A private IP address from your VPC's CIDR range confirms the override is working; a public IP address (typically starting 3.x.x.x or 65.x.x.x) means the private hosted zone is not being applied — check that the VPC is associated with the zone, the zone name matches, and the CNAME record exists.
Optionally, run dig +short <cluster-id>.<region>.vpce.aws.clickhouse.cloud to confirm the CNAME target resolves to the same private IP.
Optionally, run nc -zv <cluster-id>.<region>.aws.clickhouse.cloud 8443 to confirm connectivity to ClickHouse over the private path.
Troubleshoot private connectivity
Service name couldn't be verified: Contact ClickHouse Cloud support to enable PrivateLink for your region.
Connection timed out: Confirm the VPC endpoint's security group allows inbound access on ports 443, 8443, 9440, and 3306, and that outbound rules on the Striim host allow the connection.
Private Hostname: Not found address of host: DNS is not configured correctly; revisit the private hosted zone and CNAME setup.
Connection reset by peer: Confirm the AWS endpoint ID has been added to the ClickHouse Cloud service's allow list.
Using SSL X.509 authentication for ClickHouse
Having SSL/TLS configured in the ClickHouse cluster is a prerequisite to setup X.509 SSL certificate based user authentication. The SSL X.509 authentication is based on the Common Name presented by the client’s certificate that is signed by the Certificate Authority (Certificate Authority).
What to do in ClickHouse
Create an SSL X.509 key using the following syntax:
openssl req -newkey rsa:2048 -nodes -subj "/CN=<host name>:<user name>" -keyout <user key>.key -out <my_csr>.csr
For example, the following command will create a Certificate Signing Request (CSR) and an SSL key file
chnode1_cert_user.keywith common namechnode1.marsnet.local:cert_user:openssl req -newkey rsa:2048 -nodes -subj "/CN=chnode1.marsnet.local:cert_user" -keyout chnode1_cert_user.key -out chnode1_cert_user.csr
Create an SSL X.509 certificate:
openssl x509 -req -in <my_csr>.csr -out <name for new certificate>.crt -CA <CA certificate>.crt -CAkey <my_ca_cert>.key -days 365
For example, the following command (using the CSR file created in the previous step) will generate the SSL X.509 certificate
chnode1_cert_user.crt:openssl x509 -req -in chnode1_cert_user.csr -out chnode1_cert_user.crt -CA marsnet_ca.crt -CAkey marsnet_ca.key -days 365
Create a SQL user associated with the SSL X509 certificate:
CREATE USER <user name> IDENTIFIED WITH ssl_certificate CN '<host name>:<user name>';
For example, the following command creates a SQL user matching the common name of the SSL certificate created in the previous step,
chnode1.marsnet.local:cert_user:CREATE USER cert_user IDENTIFIED WITH ssl_certificate CN 'chnode1.marsnet.local:cert_user';
Alternatively, alter an existing user:
ALTER USER <user name> IDENTIFIED WITH ssl_certificate CN '<host name>:<user name>';
For example, to map
existinguserto the SSL X.509 certificate created in the previous step using its common namechnode1.marsnet.local:cert_user:ALTER USER existinguser IDENTIFIED WITH ssl_certificate CN 'chnode1.marsnet.local:cert_user';
What to do in Striim
Configure the following properties in a ClickHouse connection profile:
Username: the user name from step 3 above.
Client SSL Certificate Path: upload the SSL certificate file from step 2 above.
Client SSK Key Path: upload the key file from step 1 above.
CA certificate path: upload the CA certificate used in step 2 above.
Create a ClickHouse Connection Profile
A Connection Profile stores the connection URL, authentication type, and credentials that ClickHouse Writer uses to connect to ClickHouse. Create a Connection Profile before you configure a ClickHouse Writer target so that the target can reference it by name.
Connection Profile properties
Property | Type | Default | Description |
|---|---|---|---|
Connection URL | String |
| The JDBC connection URL, in the form |
Authentication Type | String | Password | Password or SSL X.509. Microsoft Entra ID Service Principal authentication is available as a preview feature. |
Username | String |
| The ClickHouse user that ClickHouse Writer connects as. If using Password authentication, the user must have the permissions described in Prerequisites If using SSL X.509 authentication, see Using SSL X.509 authentication for ClickHouse. |
Password | encrypted password |
| Required when using Password authentication. Password for the specified user. |
Client SSL Certificate Path | String (with upload) |
| Required when using SSL X.509 authentication. See Using SSL X.509 authentication for ClickHouse. |
Client SSL Key Path | String (with upload) |
| Required when using SSL X.509 authentication. See Using SSL X.509 authentication for ClickHouse. |
CA Certificate Path | String (with upload) |
| Required when using SSL X.509 authentication. See Using SSL X.509 authentication for ClickHouse. |
Note
The Password value may be stored in a Vault. The SSL files can not.
Microsoft Entra ID Service Principal authentication (preview)
ClickHouse Writer includes a preview-only authentication method that connects using an Azure Entra ID application with the OAuth Client Credentials flow, instead of a ClickHouse username and password. Because this method is in preview, confirm its support status and availability with your Striim representative before relying on it in production. It requires Client ID, Client Secret, and Tenant ID properties, and a corresponding ClickHouse ROLE whose name matches an Entra ID app role value assigned to your application's service principal. Setting this up requires configuration in both the Azure portal and ClickHouse, and requires ClickHouse Cloud support to enable JWT and Entra ID authentication on your service.
Rotate credentials and certificates
You can rotate ClickHouse Writer credentials without undeploying a running application. Depending on the authentication type, you can update the Username and Password, or the Client SSL Certificate Path, Client SSL Key Path, and CA Certificate Path, or the Microsoft Entra Service Principal Client ID, Client Secret, and Tenant ID. To rotate credentials, open Connection Profiles, edit the profile, update the relevant fields, and save.