This tutorial guides you through creating a ClickHouse® cluster in DoubleCloud using a method of your choice.
Learn how to create and configure a cluster in the DoubleCloud console or using the API, SDK, or Terraform.
Console
Terraform
API
Python
Go
Step 1. Configure resources
Go to the Clusters page
in the console
and click Create cluster at the top right.
Select ClickHouse.
Choose a provider and region.
You can create Managed ClickHouse® clusters on AWS or Google Cloud in any of the available regions.
By default, DoubleCloud preselects the region nearest to you.
In the Resources section,
select between the x86 or ARM machine type
and then select a resource preset that’s suitable for your expected workload.
For testing or development, you can select any preset.
In production, ClickHouse® developers recommend having at least 16 GB of RAM.
Select the number of shards, number of replicas, and amount of RAM for your workload.
For a high-availability configuration,
make sure to select at least three replicas.
About shards and replicas
Replicas are ClickHouse® hosts that hold a copy of the data in the cluster or shard.
Storing the same data in several replicas enables higher data availability and redundancy.
Learn more
Shards refer to subsets of data.
Sharding data across multiple servers allows you to distribute and divide the load
so that you don’t exceed the capacity of a single server.
Learn more
Under Basic settings, enter a cluster name, such as clickhouse-dev.
In Version, select the ClickHouse® version for the cluster.
Unless you need a specific version, select the latest one.
Step 2. Configure advanced settings
Under Maintenance settings, select between the arbitrary and scheduled maintenance:
About maintenance settings
If you select Arbitrary, DoubleCloud selects the maintenance window automatically.
Usually, maintenance takes place at the earliest available time slot.
Warning
If your cluster has only one host, arbitrary maintenance can make it unavailable at a random time.
To perform maintenance on a specific date and time,
select By schedule and specify the day and time (UTC)
when you want the cluster maintenance to be performed.
In Autoscaling, select whether you want the cluster resources to automatically scale
and specify the maximum limits they can increase to.
If autoscaling is enabled, DoubleCloud regularly checks the resource utilization
and automatically adjusts them depending on the cluster usage.
Learn more
In ClickHouse Keeper hosts, select the deployment mode.
About ClickHouse Keeper hosts
In the embedded mode, ClickHouse Keeper shares hosts with ClickHouse®.
In the dedicated mode, ClickHouse Keeper uses three separate hosts,
which improves performance, availability, and fault tolerance.
Learn more
For high-load production clusters, make sure to use dedicated ClickHouse Keeper hosts for better performance
— when running on separate hosts, ClickHouse® and ClickHouse Keeper don’t compete for CPU and RAM.
Warning
You can’t change the ClickHouse Keeper deployment mode after creating the cluster.
For dedicated ClickHouse Keeper hosts, select the appropriate resource preset.
It applies to all three hosts and is billed accordingly.
Under Networking → VPC, select the network where you want to create the cluster.
If you don’t need to place the cluster in a specific network, leave the preselected default option.
In the Summary block on the right, review the resources to be created and their price.
Click Submit.
Creating a cluster usually takes five to seven minutes depending on the cloud provider and region.
When the cluster is ready, its status changes from Creating to Alive.
To view the cluster details, select it from the cluster list:
This example contains a minimum set of parameters required to create a functional example cluster.
When you create your production cluster, make sure to use the configuration that is suitable for your needs.
For a full list of available parameters, refer to the
DoubleCloud ClickHouse cluster resource schema .
To create a ClickHouse® cluster, use the ClusterServicecreate method. The required parameters to create a functional cluster:
project_id: ID of your project.
You can get the ID on your project’s information page.
resource_preset_id: Name of the resource preset for your cluster.
For the list of available presets for ClickHouse® clusters,
refer to DoubleCloud hardware instances.
disk_size: Storage size for your cluster in bytes.
replica_count: Number of replicas between 1 and 3.