ClickHouse® Node Groups
A ClickHouse® managed database cluster consists of node groups:
- shards;
- ClickHouse® Keeper — added automatically when creating a cluster if it contains a shard with two or more nodes or multiple shards.
You can create a cluster from at least one shard with one node.
Shard
A shard is a group of replica nodes that stores data, processes requests, and participates in replication and sharding. Read more about shards in the Table shards and replicas article in the ClickHouse® documentation.
In managed ClickHouse® databases, a shard can consist of one or more nodes. The total number of nodes in a shard cannot exceed ten.
A cluster can contain no more than ten shards.
To simplify data work, shards can be combined into groups and tables placed in the required group. Read more in the Managing shard groups guide.
Replication
During replication, data is duplicated across all nodes of a shard. If one of the nodes in a shard fails, the data in that shard remains accessible.
We recommend creating fault-tolerant clusters with data replication.
Sharding
During sharding, data is split into parts and distributed across different shards. This allows for parallel request processing.
Sharding is available only if the cluster has more than one shard. You can specify the number of shards when creating a cluster or add shards to an existing cluster.
To start sharding in a cluster, create a distributed table. Read more about distributed tables in the Distributed table engine article in the ClickHouse® documentation.
Shard weight
Each shard can have a weight—a portion of data it will receive when distributed across shards. Data is distributed in proportion to the weights of all shards in the cluster. The higher the shard weight, the more data will be written to it. Available weight values are from 0 to 65 535.
For example, a cluster has two shards: shard1 with a weight of 70 and shard2 with a weight of 100. The total sum of weights in the cluster is 70 + 100 = 170. shard1 will receive (70 / 170) × 100% = 41% of the data. shard2 will receive (100 / 170) × 100% = 59% of the data.
ClickHouse® Keeper
ClickHouse® Keeper is a group of nodes responsible for data consistency, replica synchronization, and executing distributed DDL requests. Read more about ClickHouse® Keeper in the ClickHouse® Keeper article in the ClickHouse® documentation.
A ClickHouse® Keeper node group is required for all cluster configurations except single-node ones. This node group is added automatically when creating a cluster if it contains a shard with two or more nodes or multiple shards. You can also add ClickHouse® Keeper after cluster creation.
A ClickHouse® Keeper node group always consists of three nodes. The number of nodes in this group cannot be changed. You can change the configuration of ClickHouse® Keeper — read more in the Scale a ClickHouse® cluster guide.
ClickHouse® is a registered trademark of ClickHouse, Inc. https://clickhouse.com.