ClickHouse® Cluster Fault Tolerance
ClickHouse® cluster fault tolerance is affected by:
- availability of data replication;
- node allocation type.
Data replication
Replication is supported only for replicated tables. Learn more about replicated tables in the Replicated* table engines section of the ClickHouse® documentation.
To ensure data replication and enable the creation of replicated tables, the cluster must consist of:
- at least one shard with two or more nodes;
- and node groups ClickHouse® Keeper.
You can specify the number of nodes in a shard when creating a cluster. You can also add or remove nodes in a shard of an existing cluster. The maximum number of nodes in a shard is ten.
If you specify more than one node in a shard when creating a cluster, ClickHouse® Keeper will be added automatically.
To add nodes to an existing cluster consisting of a single shard with one node, you must first add ClickHouse® Keeper. When adding ClickHouse® Keeper, existing MergeTree tables are automatically converted to replicated ones (for example, to ReplicatedMergeTree). When adding new nodes to such a cluster, they are automatically synchronized with existing replicas in the shard.
Node allocation type
The node allocation type in a cluster depends on:
- the number of nodes in shards;
- the type of pool where the cluster is located;
- the number of segments in the pool;
- configuration line.
You can view the list of pools and segments in the Servercore Infrastructure table of the Locations: countries, regions, availability zones, pools, and data center addresses instruction.
Four node allocation types are available:
- Single-Segment;
- Multi-Segment;
- Single-AZ;
- Multi-AZ.
Single-Segment
Multi-Segment
Single-AZ
Multi-AZ
Nodes are placed in the same segment of a single-zone pool. Applicable:
- clusters consisting of one shard with one node;
- shards with multiple nodes, if the cluster is located in a pool that consists of a single segment;
- shards with multiple nodes in HighFreq configuration lines.
For example, you have created a cluster in the ru-2 pool with ClickHouse® Keeper and a shard with two nodes. For both groups of nodes, you used configurations from the HighFreq line. All nodes will be placed in the same pool segment, for example, ru-2c.
Add a node
A shard can contain no more than ten nodes. During the node addition process, other nodes in the shard will continue to operate for read and write operations.
- If the cluster consists of only one shard with one node, add ClickHouse® Keeper.
- In the Dashboard, on the top menu, click Products and select Managed Databases.
- Open the Active tab.
- Open the cluster page → Settings tab.
- In the shard menu, select Change node count.
- Open the Add tab.
- Specify the new number of nodes in the shard. If there are no free IP addresses in the subnet to which the cluster is connected, you cannot add a node. Each new node occupies a new IP address in the subnet.
- Click Save.
Delete a node
Deleting a node will remove all data located on that node.
Other nodes in the shard will continue to operate in read and write mode during deletion. The public IP address associated with the node will be deleted.
- In the Dashboard, on the top menu, click Products and select Managed Databases.
- Open the Active tab.
- Open the cluster page → Settings tab.
- In the shard menu, select Change node count.
- Open the Delete tab.
- Select the node you want to remove. At least one node must remain in the shard. You cannot remove all nodes from a shard.
- Click Save.
ClickHouse® is a registered trademark of ClickHouse, Inc. https://clickhouse.com.