ClickHouse Deployment Guide
Last updated
Was this helpful?
Last updated
Was this helpful?
Sign up at
Click Create new Service
Fill in the desired details for your ClickHouse server, choosing a name cloud provider and preferred region. Production
is recommended. Scaling and idling is up to the demands of your application. When done, click Create Service.
CloudQuery expects the ClickHouse DSN in the following format:
To find the DSN in ClickHouse Cloud:
In the left sidebar, click Connect.
Select Native and copy the host and password from the dialog box:
To connect to the a specific database, add the required database at the end of the connection string - or leave blank to connect to the default
database. The clickhouse connection string should now look like this:
(Optional) If you have the ClickHouse client installed, the DSN can by test by establishing a connection to your instance:
A domain name for the cluster (e.g. clickhouse.example.com
)
An SSL certificate in AWS Certificate Manager (ACM) with the cluster domain as a valid common name (CN) or subject alternative domain (SAN)
Run terraform init
to initialize the Terraform stack.
Run terraform plan
to preview the stack to be deployed.
Run terraform apply
to deploy the stack.
Retrieve the database credentials using the clickhouse_credentials_arn
from the Terraform output:
The clickhouse connection string should look like the following, where the password
is retrieved from the AWS secrets manager:
Connect to the ClickHouse instance using the clickhouse client:
Create the assets database for the CloudQuery platform to populate e.g.
In , select your service.
CloudQuery publishes a to make it easier to deploy a self hosted version of ClickHouse to your AWS account.
For this example, the deployment includes 3 (for horizontal scaling) with 2 each (for high availability), secured with TLS, and fronted by a Network Load Balancer (NLB).
and greater
and
Create a main.tf
with the content, below, replacing the region
, cluster_domain
and the tls_certificate_arn
. The main.tf
has some basic configurations included, and you can find the full set in the .