Yandex Cloud
Search
Contact UsTry it for free
  • Customer Stories
  • Documentation
  • Blog
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • AI for business
    • Security
    • DevOps tools
    • Serverless
    • Monitoring & Resources
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Center for Technologies and Society
    • Yandex Cloud Partner program
    • Price calculator
    • Pricing plans
  • Customer Stories
  • Documentation
  • Blog
© 2025 Direct Cursus Technology L.L.C.
Yandex Managed Service for ClickHouse®
  • Getting started
    • All guides
      • Managing shards
      • Managing shard groups
  • Access management
  • Pricing policy
  • Terraform reference
  • Yandex Monitoring metrics
  • Audit Trails events
  • Public materials
  • Release notes

In this article:

  • Getting a list of shard groups in a cluster
  • Getting detailed information about a shard group
  • Creating a shard group
  • Updating a shard group
  • Deleting a shard group
  1. Step-by-step guides
  2. Sharding
  3. Managing shard groups

Managing shard groups in a ClickHouse® cluster

Written by
Yandex Cloud
Updated at December 17, 2025
  • Getting a list of shard groups in a cluster
  • Getting detailed information about a shard group
  • Creating a shard group
  • Updating a shard group
  • Deleting a shard group

You can arrange several shards of a ClickHouse® cluster into a shard group and then place tables in that group.

Getting a list of shard groups in a clusterGetting a list of shard groups in a cluster

Management console
CLI
REST API
gRPC API
  1. In the management console, select the folder the cluster is in.
  2. Go to Managed Service for ClickHouse.
  3. Click the cluster name and select the Shard groups tab.

If you do not have the Yandex Cloud CLI installed yet, install and initialize it.

By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id parameter.

To get a list of shard groups in a cluster, run this command:

yc managed-clickhouse shard-groups list \
   --cluster-name=<cluster_name>

You can get the cluster name with the list of clusters in the folder.

  1. Get an IAM token for API authentication and place it in an environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Call the Cluster.ListShardGroups method, e.g., via the following cURL request:

    curl \
      --request GET \
      --header "Authorization: Bearer $IAM_TOKEN" \
      --url 'https://mdb.api.cloud.yandex.net/managed-clickhouse/v1/clusters/<cluster_ID>/shardGroups'
    

    You can get the cluster ID with the list of clusters in the folder.

  3. View the server response to make sure your request was successful.

  1. Get an IAM token for API authentication and place it in an environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Clone the cloudapi repository:

    cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
    

    Below, we assume the repository contents are stored in the ~/cloudapi/ directory.

  3. Call the ClusterService.ListShardGroups method, e.g., via the following gRPCurl request:

    grpcurl \
      -format json \
      -import-path ~/cloudapi/ \
      -import-path ~/cloudapi/third_party/googleapis/ \
      -proto ~/cloudapi/yandex/cloud/mdb/clickhouse/v1/cluster_service.proto \
      -rpc-header "Authorization: Bearer $IAM_TOKEN" \
      -d '{
            "cluster_id": "<cluster_ID>"
          }' \
      mdb.api.cloud.yandex.net:443 \
      yandex.cloud.mdb.clickhouse.v1.ClusterService.ListShardGroups
    

    You can get the cluster ID with the list of clusters in the folder.

  4. View the server response to make sure your request was successful.

Getting detailed information about a shard groupGetting detailed information about a shard group

Management console
CLI
REST API
gRPC API
  1. In the management console, select the folder the cluster is in.
  2. Go to Managed Service for ClickHouse.
  3. Click the cluster name and select the Shard groups tab.
  4. Select a shard group to view detailed information.

If you do not have the Yandex Cloud CLI installed yet, install and initialize it.

By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id parameter.

To view detailed information about a shard group in a cluster, run this command:

yc managed-clickhouse shard-groups get \
  --cluster-name=<cluster_name> \
  --name=<shard_group_name>

You can get the cluster name with the list of clusters in the folder.

  1. Get an IAM token for API authentication and place it in an environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Call the Cluster.GetShardGroup method, e.g., via the following cURL request:

    curl \
      --request GET \
      --header "Authorization: Bearer $IAM_TOKEN" \
      --url 'https://mdb.api.cloud.yandex.net/managed-clickhouse/v1/clusters/<cluster_ID>/shardGroups/<shard_group_name>'
    

    You can get the cluster ID with a list of clusters in the folder, and the shard group name, with a list of groups in the cluster.

  3. View the server response to make sure your request was successful.

  1. Get an IAM token for API authentication and place it in an environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Clone the cloudapi repository:

    cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
    

    Below, we assume the repository contents are stored in the ~/cloudapi/ directory.

  3. Call the ClusterService.GetShardGroup method, e.g., via the following gRPCurl request:

    grpcurl \
      -format json \
      -import-path ~/cloudapi/ \
      -import-path ~/cloudapi/third_party/googleapis/ \
      -proto ~/cloudapi/yandex/cloud/mdb/clickhouse/v1/cluster_service.proto \
      -rpc-header "Authorization: Bearer $IAM_TOKEN" \
      -d '{
            "cluster_id": "<cluster_ID>",
            "shard_group_name": "<shard_group_name>"
          }' \
      mdb.api.cloud.yandex.net:443 \
      yandex.cloud.mdb.clickhouse.v1.ClusterService.GetShardGroup
    

    You can get the cluster ID with a list of clusters in the folder, and the shard group name, with a list of groups in the cluster.

  4. View the server response to make sure your request was successful.

Creating a shard groupCreating a shard group

Management console
CLI
Terraform
REST API
gRPC API
  1. In the management console, select the folder the cluster is in.
  2. Go to Managed Service for ClickHouse.
  3. Click the cluster name and select the Shard groups tab.
  4. Click Create shard group.
  5. Fill in the form fields and click Apply.

If you do not have the Yandex Cloud CLI installed yet, install and initialize it.

By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id parameter.

To create a shard group in a cluster, run this command:

yc managed-clickhouse shard-groups create \
  --cluster-name=<cluster_name> \
  --name=<shard_group_name> \
  --description=<shard_group_description> \
  --shards=<list_of_shard_names>

Where --shards is the list of shard names to include in the group.

You can get the cluster name with the list of clusters in the folder.

You can get the shard names with a list of shards in the cluster.

  1. Open the current Terraform configuration file describing your infrastructure.

    For information on how to create such a file, see Creating a cluster.

  2. Add the shard_group section to the Managed Service for ClickHouse® cluster description.

    resource "yandex_mdb_clickhouse_cluster" "<cluster_name>" {
      ...
      shard_group {
        name        = "<shard_group_name>"
        description = "<optional_description_for_shard_group>"
        shard_names = [
          # List of shards in the group
          "<shard_1_name>",
          ...
          "<shard_N_name>"
        ]
      }
    }
    
  3. Make sure the settings are correct.

    1. In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.

    2. Run this command:

      terraform validate
      

      Terraform will show any errors found in your configuration files.

  4. Confirm updating the resources.

    1. Run this command to view the planned changes:

      terraform plan
      

      If you described the configuration correctly, the terminal will display a list of the resources to update and their parameters. This is a verification step that does not apply changes to your resources.

    2. If everything looks correct, apply the changes:

      1. Run this command:

        terraform apply
        
      2. Confirm updating the resources.

      3. Wait for the operation to complete.

For more information, see this Terraform provider guide.

Timeouts

The Terraform provider sets the following timeouts for Managed Service for ClickHouse® cluster operations:

  • Creating a cluster, including by restoring from a backup: 60 minutes.
  • Updating a cluster: 90 minutes.
  • Deleting a cluster: 30 minutes.

Operations exceeding the timeout are aborted.

How do I change these limits?

Add a timeouts section to the cluster description, e.g.:

resource "yandex_mdb_clickhouse_cluster" "<cluster_name>" {
  ...
  timeouts {
    create = "1h30m" # 1 hour 30 minutes
    update = "2h"    # 2 hours
    delete = "30m"   # 30 minutes
  }
}
  1. Get an IAM token for API authentication and place it in an environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Call the Cluster.CreateShardGroup method, e.g., via the following cURL request:

    curl \
      --request POST \
      --header "Authorization: Bearer $IAM_TOKEN" \
      --header "Content-Type: application/json" \
      --url 'https://mdb.api.cloud.yandex.net/managed-clickhouse/v1/clusters/<cluster_ID>/shardGroups' \
      --data '{
                "shardGroupName": "<shard_group_name>",
                "description": "<shard_group_description>",
                "shardNames": [
                  "<shard_1>", "<shard_2>", ... "<shard_N>"
                ]
              }'
    

    Where:

    • shardGroupName: Shard group name.
    • description: Shard group description.
    • shardNames: List of shards to include in the new group.

    You can get the cluster ID with the list of clusters in the folder.

  3. View the server response to make sure your request was successful.

  1. Get an IAM token for API authentication and place it in an environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Clone the cloudapi repository:

    cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
    

    Below, we assume the repository contents are stored in the ~/cloudapi/ directory.

  3. Call the ClusterService.CreateShardGroup method, e.g., via the following gRPCurl request:

    grpcurl \
        -format json \
        -import-path ~/cloudapi/ \
        -import-path ~/cloudapi/third_party/googleapis/ \
        -proto ~/cloudapi/yandex/cloud/mdb/clickhouse/v1/cluster_service.proto \
        -rpc-header "Authorization: Bearer $IAM_TOKEN" \
        -d '{
              "cluster_id": "<cluster_ID>",
              "shard_group_name": "<shard_group_name>",
              "description": "<shard_group_description>",
              "shard_names": [
                "<shard_1>", "<shard_2>", ... "<shard_N>"
              ]
            }' \
        mdb.api.cloud.yandex.net:443 \
        yandex.cloud.mdb.clickhouse.v1.ClusterService.CreateShardGroup
    

    Where:

    • shard_group_name: Shard group name.
    • description: Shard group description.
    • shard_names: List of shards to include in the new group.

    You can get the cluster ID with the list of clusters in the folder.

  4. View the server response to make sure your request was successful.

Updating a shard groupUpdating a shard group

Management console
CLI
Terraform
REST API
gRPC API
  1. In the management console, select the folder the cluster is in.
  2. Go to Managed Service for ClickHouse.
  3. Click the cluster name and select the Shard groups tab.
  4. Click next to the shard group in question and select Edit.

If you do not have the Yandex Cloud CLI installed yet, install and initialize it.

By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id parameter.

To update a shard group in a cluster, run this command:

yc managed-clickhouse shard-groups update \
  --cluster-name=<cluster_name> \
  --name=<shard_group_name> \
  --description=<new_description_for_shard_group> \
  --shards=<new_list_of_shard_names>

Where --shards is the new list of shard names to include in the group.

This command replaces the existing list of shards in the group with the new one provided in the --shards parameter. Before running the command, make sure you have added all the required shards to the new list.

You can get the cluster name with the list of clusters in the folder.

You can get the shard group name with a list of shard groups in the cluster.

You can get the shard names with a list of shards in the cluster.

  1. Open the current Terraform configuration file describing your infrastructure.

    For information on how to create such a file, see Creating a cluster.

  2. In the Managed Service for ClickHouse® cluster description, update the shard_group section for the shard group you need:

    resource "yandex_mdb_clickhouse_cluster" "<cluster_name>" {
      ...
      shard_group {
        name        = "<new_name_for_shard_group>"
        description = "<new_description_for_shard_group>"
        shard_names = [
          # New list of shards in the group
          "<shard_1_name>",
          ...
          "<shard_N_name>"
        ]
      }
    }
    
  3. Make sure the settings are correct.

    1. In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.

    2. Run this command:

      terraform validate
      

      Terraform will show any errors found in your configuration files.

  4. Confirm updating the resources.

    1. Run this command to view the planned changes:

      terraform plan
      

      If you described the configuration correctly, the terminal will display a list of the resources to update and their parameters. This is a verification step that does not apply changes to your resources.

    2. If everything looks correct, apply the changes:

      1. Run this command:

        terraform apply
        
      2. Confirm updating the resources.

      3. Wait for the operation to complete.

For more information, see this Terraform provider guide.

Timeouts

The Terraform provider sets the following timeouts for Managed Service for ClickHouse® cluster operations:

  • Creating a cluster, including by restoring from a backup: 60 minutes.
  • Updating a cluster: 90 minutes.
  • Deleting a cluster: 30 minutes.

Operations exceeding the timeout are aborted.

How do I change these limits?

Add a timeouts section to the cluster description, e.g.:

resource "yandex_mdb_clickhouse_cluster" "<cluster_name>" {
  ...
  timeouts {
    create = "1h30m" # 1 hour 30 minutes
    update = "2h"    # 2 hours
    delete = "30m"   # 30 minutes
  }
}
  1. Get an IAM token for API authentication and place it in an environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Call the Cluster.updateShardGroup method, e.g., via the following cURL request:

    Warning

    The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the updateMask parameter as a single comma-separated string.

    curl \
      --request PATCH \
      --header "Authorization: Bearer $IAM_TOKEN" \
      --header "Content-Type: application/json" \
      --url 'https://mdb.api.cloud.yandex.net/managed-clickhouse/v1/clusters/<cluster_ID>/shardGroups/<shard_group_name>' \
      --data '{
                "updateMask": "description,shardNames",
                "description": "<shard_group_description>",
                "shardNames": [
                  "<shard_1>", "<shard_2>", ... "<shard_N>"
                ]
              }'
    

    Where:

    • updateMask: Comma-separated list of settings you want to update.
    • description: New description for the shard group.
    • shardNames: New list of shards to include in the group. To learn shard names, get a list of shards in the cluster. This list will replace the current one, so make sure you have added all the required shards to the new list.

    You can get the cluster ID with a list of clusters in the folder, and the shard group name, with a list of groups in the cluster.

  3. View the server response to make sure your request was successful.

  1. Get an IAM token for API authentication and place it in an environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Clone the cloudapi repository:

    cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
    

    Below, we assume the repository contents are stored in the ~/cloudapi/ directory.

  3. Call the ClusterService.UpdateShardGroup method, e.g., via the following gRPCurl request:

    Warning

    The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the update_mask parameter as an array of paths[] strings.

    Format for listing settings
    "update_mask": {
        "paths": [
            "<setting_1>",
            "<setting_2>",
            ...
            "<setting_N>"
        ]
    }
    
    grpcurl \
      -format json \
      -import-path ~/cloudapi/ \
      -import-path ~/cloudapi/third_party/googleapis/ \
      -proto ~/cloudapi/yandex/cloud/mdb/clickhouse/v1/cluster_service.proto \
      -rpc-header "Authorization: Bearer $IAM_TOKEN" \
      -d '{
            "cluster_id": "<cluster_ID>",
            "shard_group_name": "<shard_group_name>",
            "update_mask": {
              "paths": [
                "description", "shard_names"
              ]
            },
            "description": "<shard_group_description>",
            "shard_names": [
              "<shard_1>", "<shard_2>", ... "<shard_N>"
            ]
          }' \
      mdb.api.cloud.yandex.net:443 \
      yandex.cloud.mdb.clickhouse.v1.ClusterService.UpdateShardGroup
    

    Where:

    • update_mask: List of settings you want to update as an array of strings (paths[]).
    • description: New description for the shard group.
    • shard_names: New list of shards to include in the group. To learn shard names, get a list of shards in the cluster. This list will replace the current one, so make sure you have added all the required shards to the new list.

    You can get the cluster ID with a list of clusters in the folder, and the shard group name, with a list of groups in the cluster.

  4. View the server response to make sure your request was successful.

Deleting a shard groupDeleting a shard group

Deleting a shard group does not affect the shards it contains, i.e., they remain in the cluster.

Tables created on the deleted group remain but become unusable: any attempts to query them will return errors. However, you can delete these tables before or after deleting the shard group.

Management console
CLI
Terraform
REST API
gRPC API
  1. In the management console, select the folder the cluster is in.
  2. Go to Managed Service for ClickHouse.
  3. Click the cluster name and select the Shard groups tab.
  4. Click next to the shard group in question and select Delete.

If you do not have the Yandex Cloud CLI installed yet, install and initialize it.

By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id parameter.

To delete a shard group in a cluster, run this command:

yc managed-clickhouse shard-groups delete \
   --cluster-name=<cluster_name> \
   --name=<shard_group_name>

You can get the cluster name with the list of clusters in the folder.

You can get the shard group name with a list of shard groups in the cluster.

  1. Open the current Terraform configuration file describing your infrastructure.

    For information on how to create such a file, see Creating a cluster.

  2. Delete the shard_group section for the appropriate group from the Managed Service for ClickHouse® cluster description.

  3. Make sure the settings are correct.

    1. In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.

    2. Run this command:

      terraform validate
      

      Terraform will show any errors found in your configuration files.

  4. Type yes and press Enter.

    1. Run this command to view the planned changes:

      terraform plan
      

      If you described the configuration correctly, the terminal will display a list of the resources to update and their parameters. This is a verification step that does not apply changes to your resources.

    2. If everything looks correct, apply the changes:

      1. Run this command:

        terraform apply
        
      2. Confirm updating the resources.

      3. Wait for the operation to complete.

For more information, see this Terraform provider guide.

Timeouts

The Terraform provider sets the following timeouts for Managed Service for ClickHouse® cluster operations:

  • Creating a cluster, including by restoring from a backup: 60 minutes.
  • Updating a cluster: 90 minutes.
  • Deleting a cluster: 30 minutes.

Operations exceeding the timeout are aborted.

How do I change these limits?

Add a timeouts section to the cluster description, e.g.:

resource "yandex_mdb_clickhouse_cluster" "<cluster_name>" {
  ...
  timeouts {
    create = "1h30m" # 1 hour 30 minutes
    update = "2h"    # 2 hours
    delete = "30m"   # 30 minutes
  }
}
  1. Get an IAM token for API authentication and place it in an environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Call the Cluster.DeleteShardGroup method, e.g., via the following cURL request:

    curl \
      --request DELETE \
      --header "Authorization: Bearer $IAM_TOKEN" \
      --url 'https://mdb.api.cloud.yandex.net/managed-clickhouse/v1/clusters/<cluster_ID>/shardGroups/<shard_group_name>'
    

    You can get the cluster ID with a list of clusters in the folder, and the shard group name, with a list of groups in the cluster.

  3. View the server response to make sure your request was successful.

  1. Get an IAM token for API authentication and place it in an environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Clone the cloudapi repository:

    cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
    

    Below, we assume the repository contents are stored in the ~/cloudapi/ directory.

  3. Call the ClusterService.DeleteShardGroup method, e.g., via the following gRPCurl request:

    grpcurl \
      -format json \
      -import-path ~/cloudapi/ \
      -import-path ~/cloudapi/third_party/googleapis/ \
      -proto ~/cloudapi/yandex/cloud/mdb/clickhouse/v1/cluster_service.proto \
      -rpc-header "Authorization: Bearer $IAM_TOKEN" \
      -d '{
            "cluster_id": "<cluster_ID>",
            "shard_group_name": "<shard_group_name>"
          }' \
      mdb.api.cloud.yandex.net:443 \
      yandex.cloud.mdb.clickhouse.v1.ClusterService.DeleteShardGroup
    

    You can get the cluster ID with a list of clusters in the folder, and the shard group name, with a list of groups in the cluster.

  4. View the server response to make sure your request was successful.

ClickHouse® is a registered trademark of ClickHouse, Inc.

Was the article helpful?

Previous
Managing shards
Next
Viewing cluster logs
© 2025 Direct Cursus Technology L.L.C.