---
title: "Scale a ClickHouse® cluster"
sidebar_label: "Scale cluster"
sidebar_position: 13
description: "How to change the configuration of node groups in a ClickHouse® cluster"
---

import Tabs from '@theme/Tabs'
import TabItem from '@theme/TabItem'
import {TabItemLabel} from '@selectel/docux/components'
import Formbricks from '@theme/MDXComponents/Formbricks'
import MoreVerticalIcon from '@selectel/docux/icons/more-vertical'

# Scale a ClickHouse® cluster

You can [add](#add-shard) or [delete shards](#delete-shard) in a ClickHouse® Managed Databases cluster. To add a [shard](/managed-databases/clickhouse/about-node-groups.mdx#shard) to a cluster consisting of a single shard with one node, you must first [add ClickHouse® Keeper](#add-clickhouse-keeper). [The ClickHouse® Keeper node group](/managed-databases/clickhouse/about-node-groups.mdx#clickhouse-keeper) is mandatory for all cluster configurations except the single-node one.

You can also [scale node groups](#resize-node-group) — shards and ClickHouse® Keeper. For example:

* change the [configuration](/managed-databases/clickhouse/configurations.mdx) within [lines](/managed-databases/clickhouse/configurations.mdx) with fixed configurations — you can only select a configuration with a [disk](/managed-databases/clickhouse/volumes.mdx) size larger than the current one;

* increase the number of vCPUs, RAM, and disk size in a line with custom configurations;

* change the configuration line to another one with the same disk type but a larger disk size. You cannot change a line with a local disk to a line with a network volume, or vice versa.

## Add shard \{#add-shard}

You can add only one [shard](/managed-databases/clickhouse/about-node-groups.mdx#shard) at a time. The cluster can have no more than ten shards.

1. If the cluster consists of only one shard with one node, [add ClickHouse® Keeper](#add-clickhouse-keeper).

2. In the [Dashboard](https://my.selectel.ru/vpc/default/dbaas/), on the top menu click **Products** and select **Managed Databases**.

3. Open the **Active** tab.

4. Open the database cluster page → **Settings** tab.

5. In the **Cluster** block, click **Add shard**.

6. Optional: change the shard name.

7. Select a [configuration line](/managed-databases/clickhouse/configurations.mdx).

8. If you selected a line with custom configurations, select the [disk](/managed-databases/clickhouse/volumes.mdx) type and specify the number of vCPUs, RAM size, and disk size.

9. If you selected a line with fixed configurations, select a [configuration](/managed-databases/clickhouse/configurations.mdx).

10. Specify the number of nodes in the shard.

11. Optional: to make the shard nodes accessible from the internet, select the **Enable public access** checkbox. A separate [public IP address](/managed-databases/clickhouse/public-ip.mdx) will be assigned to each shard node.

    If the cluster subnet does not meet the [requirements](/managed-databases/clickhouse/public-ip.mdx#requirements), enabling public access is not available. You can [prepare a private subnet](/managed-databases/clickhouse/public-ip.mdx#configure-subnet) and [connect a public IP address](/managed-databases/clickhouse/public-ip.mdx#assign-public-ip-in-existing-cluster) after adding the shard.

12. Optional: specify the [shard weight](/managed-databases/clickhouse/about-node-groups.mdx#shard-weight). Values from 0 to 65 535 are available.

13. Click **Save**.

## Add ClickHouse® Keeper \{#add-clickhouse-keeper}

:::info

[The ClickHouse® Keeper node group](/managed-databases/clickhouse/about-node-groups.mdx#clickhouse-keeper) cannot be removed from the cluster after it has been added.

:::

When adding ClickHouse® Keeper, MergeTree tables are automatically converted to replicated tables (for example, to ReplicatedMergeTree). Learn more about replicated tables in the [Replicated\* table engines](https://clickhouse.com/docs/engines/table-engines/mergetree-family/replication) section of the ClickHouse® documentation.

1. In the [Dashboard](https://my.selectel.ru/vpc/default/dbaas/), on the top menu click **Products** and select **Managed Databases**.

2. Open the **Active** tab.

3. Open the database cluster page → **Settings** tab.

4. In the **Cluster** block, click **Add ClickHouse Keeper**.

5. Optional: change the [node group](/managed-databases/clickhouse/about-node-groups.mdx) name.

6. Select a [configuration line](/managed-databases/clickhouse/configurations.mdx).

7. If you selected a line with custom configurations, select the [disk](/managed-databases/clickhouse/volumes.mdx) type and specify the number of vCPUs, RAM size, and disk size.

8. If you selected a line with fixed configurations, select a [configuration](/managed-databases/clickhouse/configurations.mdx).

9. Click **Save**.

## Delete shard \{#delete-shard}

:::danger

Deleting a [shard](/managed-databases/clickhouse/about-node-groups.mdx#shard) will remove all data located on that shard.

:::

You can delete a shard from the cluster if it is not the only shard.

1. In the [Dashboard](https://my.selectel.ru/vpc/default/dbaas/), on the top menu click **Products** and select **Managed Databases**.

2. Open the **Active** tab.

3. Open the cluster page → **Settings** tab.

4. In the  shard menu, select **Delete**.<MoreVerticalIcon />

5. Enter the shard name to confirm.

6. Click **Delete**.

## Scale node group \{#resize-node-group}

:::warning

Active connections to the nodes will be interrupted during the node group scaling process.

:::

1. In the [Dashboard](https://my.selectel.ru/vpc/default/dbaas/), on the top menu, click **Products** and select **Managed Databases**.

2. Open the **Active** tab.

3. Open the database cluster page → **Settings** tab.

4. In the  node group menu, select **Change configuration**.<MoreVerticalIcon />

5. Optional: change the node group name.

6. Scale a node group. You can:

   * change the [configuration](/managed-databases/clickhouse/configurations.mdx) within [tiers](/managed-databases/clickhouse/configurations.mdx) with fixed configurations — you can select a configuration only with a disk size larger than the current one;
   * increase the number of vCPU, RAM, and [disk](/managed-databases/clickhouse/volumes.mdx) size in a [tier](/managed-databases/clickhouse/configurations.mdx) with custom configurations;
   * change the configuration line to another one with the same disk type but a larger disk size. You cannot change a line with a local disk to a line with a network volume, or vice versa.

7. Click **Save**.

ClickHouse® is a registered trademark of ClickHouse, Inc. https://clickhouse.com.

<Formbricks />
