Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
  • Blog
  • Pricing
  • Documentation
Yandex project
© 2025 Yandex.Cloud LLC
Yandex Managed Service for ClickHouse®
  • Getting started
    • All guides
      • Information about existing clusters
      • Creating a cluster
      • Updating cluster settings
      • ClickHouse® version upgrade
      • Stopping and starting a cluster
        • Managing ClickHouse® hosts
        • Managing ZooKeeper hosts
        • Migrating hosts to a different availability zone
      • Managing backups
      • Deleting a cluster
  • Access management
  • Terraform reference
  • Yandex Monitoring metrics
  • Audit Trails events
  • Public materials
  • Release notes

In this article:

  • Getting a list of cluster hosts
  • Adding ZooKeeper hosts
  • Updating ZooKeeper host settings
  • Restarting a ZooKeeper host
  • Converting non-replicated tables to replicated
  • Removing a ZooKeeper host
  1. Step-by-step guides
  2. Clusters
  3. Managing hosts
  4. Managing ZooKeeper hosts

Managing ZooKeeper hosts

Written by
Yandex Cloud
Updated at May 5, 2025
  • Getting a list of cluster hosts
  • Adding ZooKeeper hosts
  • Updating ZooKeeper host settings
  • Restarting a ZooKeeper host
  • Converting non-replicated tables to replicated
  • Removing a ZooKeeper host

ZooKeeper is a coordination tool you can use to distribute queries among ClickHouse® hosts for data replication. For successful replication, a Managed Service for ClickHouse® cluster must have three or five ZooKeeper hosts. This cluster will be fault-tolerant.

If you are creating a cluster with two or more ClickHouse® hosts per shard, three ZooKeeper hosts will be automatically added to the cluster. At this stage, you can only set up their configuration. If you created a single-host cluster or a cluster with multiple single-host shards, you can add ZooKeeper hosts later.

For more information about ZooKeeper hosts, see ZooKeeper.

You can perform the following actions on ZooKeeper hosts:

  • Get a list of cluster hosts.
  • Add ZooKeeper hosts.
  • Update ZooKeeper host settings.
  • Restart a host.
  • Move ZooKeeper hosts to a different availability zone.
  • Remove a host.

Getting a list of cluster hostsGetting a list of cluster hosts

Management console
CLI
REST API
gRPC API
  1. Go to the folder page and select Managed Service for ClickHouse.
  2. Click the name of the cluster you need and select the Hosts tab.

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

The folder specified when creating the CLI profile is used by default. To change the default folder, use the yc config set folder-id <folder_ID> command. You can specify a different folder using the --folder-name or --folder-id parameter.

To get a list of cluster hosts, run the command:

yc managed-clickhouse host list \
   --cluster-name=<cluster_name>
+----------------------------+--------------+---------+--------+---------------+
|            NAME            |  CLUSTER ID  |  ROLE   | HEALTH |    ZONE ID    |
+----------------------------+--------------+---------+--------+---------------+
| rc1b...mdb.yandexcloud.net | c9qp71dk1... | MASTER  | ALIVE  | ru-central1-b |
| rc1a...mdb.yandexcloud.net | c9qp71dk1... | REPLICA | ALIVE  | ru-central1-a |
+----------------------------+--------------+---------+--------+---------------+

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

  1. Get an IAM token for API authentication and put it into the environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Use the Cluster.ListHosts method and send the following request, e.g., via cURL:

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

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

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

  1. Get an IAM token for API authentication and put it into the 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. Use the ClusterService.ListHosts call and send the following request, e.g., via gRPCurl:

    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.ListHosts
    

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

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

Adding ZooKeeper hostsAdding ZooKeeper hosts

Note

Intel Broadwell is not available in the ru-central1-d availability zone.

Management console
CLI
Terraform
REST API
gRPC API
  1. In the management console, navigate to the folder page and select Managed Service for ClickHouse.

  2. Click the cluster name and open the Hosts tab.

  3. At the top right, click Set up ZooKeeper hosts.

  4. Specify the host class.

  5. Set up the storage settings.

  6. Change the ZooKeeper host settings, if required. To do this, hover over the host's row and click .

  7. To convert non-replicated tables to replicated, enable Convert non-replicated tables. Non-replicated MergeTree tables will be automatically converted to ReplicatedMergeTree ones.

    Warning

    Once this option is enabled, you cannot disable it.

  8. Click Save changes.

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

The folder specified when creating the CLI profile is used by default. To change the default folder, use the yc config set folder-id <folder_ID> command. You can specify a different folder using the --folder-name or --folder-id parameter.

To add ZooKeeper hosts to a cluster:

  1. View a description of the CLI command for adding ZooKeeper hosts:

    yc managed-clickhouse cluster add-zookeeper --help
    
  2. Run the operation with the default host characteristics:

    yc managed-clickhouse cluster add-zookeeper <cluster_name> \
       --host zone-id=ru-central1-d,subnet-name=default-d \
       --host zone-id=ru-central1-a,subnet-name=default-a \
       --host zone-id=ru-central1-b,subnet-name=default-b
    

    If the network hosting the cluster contains exactly 3 subnets, each per availability zone, you do not have to explicitly specify subnets for the hosts: Managed Service for ClickHouse® automatically distributes hosts over the subnets.

    To convert non-replicated tables to replicated, add the --convert-tables-to-replicated parameter to the command. Non-replicated MergeTree tables will be automatically converted to replicated ones based on ReplicatedMergeTree.

    Warning

    Once this option is enabled, you cannot disable it.

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

With Terraform, you can quickly create a cloud infrastructure in Yandex Cloud and manage it using configuration files. These files store the infrastructure description written in HashiCorp Configuration Language (HCL). If you change the configuration files, Terraform automatically detects which part of your configuration is already deployed, and what should be added or removed.

Terraform is distributed under the Business Source License. The Yandex Cloud provider for Terraform is distributed under the MPL-2.0 license.

For more information about the provider resources, see the documentation on the Terraform website or mirror website.

To add ZooKeeper hosts to a cluster:

  1. Open the current Terraform configuration file with an infrastructure plan.

    For more information about creating this file, see Creating clusters.

  2. Make sure the configuration file describes three subnets, one for each availability zone. Add the missing ones, if required:

    resource "yandex_vpc_network" "<network_name>" {
      name = "<network_name>"
    }
    
    resource "yandex_vpc_subnet" "<subnet_name_in_ru-central1-a_zone>" {
      name           = "<subnet_name_in_ru-central1-a_zone>"
      zone           = "ru-central1-a"
      network_id     = yandex_vpc_network.<network_name>.id
      v4_cidr_blocks = [ "<ru-central1-a_zone_subnet_IP_address_range>" ]
    }
    
    resource "yandex_vpc_subnet" "<subnet_name_in_ru-central1-b_zone>" {
      name           = "<subnet_name_in_ru-central1-b_zone>"
      zone           = "ru-central1-b"
      network_id     = yandex_vpc_network.<network_name>.id
      v4_cidr_blocks = [ "<ru-central1-b_zone_subnet_IP_address_range>" ]
    }
    
    resource "yandex_vpc_subnet" "<subnet_name_in_ru-central1-d_zone>" {
      name           = "<subnet_name_in_ru-central1-d_zone>"
      zone           = "ru-central1-d"
      network_id     = yandex_vpc_network.<network_name>.id
      v4_cidr_blocks = [ "<ru-central1-d_zone_subnet_IP_address_range>" ]
    }
    
  3. Add a ZooKeeper configuration block and at least three host blocks with the ZOOKEEPER type to the ClickHouse® cluster description.

    ZooKeeper host requirements:

    • Each availability zone must have at least one host.
    • Minimum host class: b1.medium.
    • Disk type: network-ssd.
    • The minimum storage size is 10 GB.
    resource "yandex_mdb_clickhouse_cluster" "<cluster_name>" {
      ...
      zookeeper {
        resources {
          resource_preset_id = "<host_class>"
          disk_type_id       = "network-ssd"
          disk_size          = <storage_size_in_GB>
        }
      }
      ...
      host {
        type      = "ZOOKEEPER"
        zone      = "ru-central1-a"
        subnet_id = yandex_vpc_subnet.<subnet_name_in_ru-central1-a_zone>.id
      }
      host {
        type      = "ZOOKEEPER"
        zone      = "ru-central1-b"
        subnet_id = yandex_vpc_subnet.<subnet_name_in_ru-central1-b_zone>.id
      }
      host {
        type      = "ZOOKEEPER"
        zone      = "ru-central1-d"
        subnet_id = yandex_vpc_subnet.<subnet_name_in_ru-central1-d_zone>.id
      }
    }
    

    Where resource_preset_id is the host class: b1.medium or higher.

  4. 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.

  5. 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 the Terraform provider documentation.

Time limits

A Terraform provider sets the timeout for Managed Service for ClickHouse® cluster operations:

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

Operations exceeding the set timeout are interrupted.

How do I change these limits?

Add the timeouts block to the cluster description, for example:

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 put it into the environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Use the Cluster.AddZookeeper method and send the following request, e.g., via cURL:

    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>:addZookeeper' \
      --data '{
               "resources": {
                 "resourcePresetId": "<host_class>",
                 "diskSize": "<storage_size_in_bytes>",
                 "diskTypeId": "<disk_type>"
               },
               "hostSpecs": [
                 {
                   "type": "ZOOKEEPER",
                   "zoneId": "<availability_zone>",
                   "subnetId": "<subnet_ID>"
                 },
                 { <similar_settings_for_new_host_2> },
                 { ... },
                 { <similar_settings_for_new_host_N> }
               ],
               "convertTablesToReplicated": true
             }'
    

    Where:

    • resources: Resources for ZooKeeper hosts.

      • resourcePresetId: Host class ID.
      • diskSize: Disk size in bytes.
      • diskTypeId: Disk type.
    • hostSpecs: Array with settings for the new hosts. One array element contains settings for a single host and the cluster must have at least three ZooKeeper hosts. An array element has the following structure:

      • type: ZOOKEEPER host type.
      • zoneId: Availability zone.
      • subnetId: Subnet ID.
    • convertTablesToReplicated: Converting non-replicated tables to replicated ones, true or false. Non-replicated MergeTree tables will be automatically converted to replicated ones based on ReplicatedMergeTree.

      Warning

      Once this option is enabled, you cannot disable it.

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

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

  1. Get an IAM token for API authentication and put it into the 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. Use the ClusterService.AddZookeeper call and send the following request, e.g., via gRPCurl:

    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>",
            "resources": {
              "resource_preset_id": "<host_class>",
              "disk_size": "<storage_size_in_bytes>",
              "disk_type_id": "<disk_type>"
            },
            "host_specs": [
              {
                "type": "ZOOKEEPER",
                "zone_id": "<availability_zone>",
                "subnet_id": "<subnet_ID>"
              },
              { <similar_settings_for_new_host_2> },
              { ... },
              { <similar_settings_for_new_host_N> }
            ],
            "convert_tables_to_replicated": true
          }' \
      mdb.api.cloud.yandex.net:443 \
      yandex.cloud.mdb.clickhouse.v1.ClusterService.AddZookeeper
    

    Where:

    • resources: Resources for ZooKeeper hosts.

      • resource_preset_id: Host class ID.
      • disk_size: Disk size in bytes.
      • disk_type_id: Disk type.
    • host_specs: Array with settings for the new hosts. One array element contains settings for a single host and the cluster must have at least three ZooKeeper hosts.

      An array element has the following structure:

      • type: ZOOKEEPER host type.
      • zone_id: Availability zone.
      • subnet_id: Subnet ID.
    • convert_tables_to_replicated: Converting non-replicated tables to replicated ones, true or false. Non-replicated MergeTree tables will be automatically converted to replicated ones based on ReplicatedMergeTree.

      Warning

      Once this option is enabled, you cannot disable it.

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

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

Note

ZooKeeper hosts get the following specs by default:

  • Host class: b2.medium.
  • Network SSD storage (network-ssd): 10 GB.

Updating ZooKeeper host settingsUpdating ZooKeeper host settings

After creating ZooKeeper hosts, you can only change their class and storage size. We recommend changing the host class only when the cluster has no active workload.

The minimum number of cores per ZooKeeper host depends on the total number of cores on ClickHouse® hosts. To learn more, see Replication.

Management console
CLI
Terraform
REST API
gRPC API
  1. In the management console, navigate to the folder page and select Managed Service for ClickHouse.
  2. Select the cluster and click Edit in the top panel.
  3. Under ZooKeeper host class, select the platform, VM type, and required ZooKeeper host class.
  4. Under ZooKeeper storage size, set ZooKeeper storage size.
  5. Click Save changes.

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

The folder specified when creating the CLI profile is used by default. To change the default folder, use the yc config set folder-id <folder_ID> command. You can specify a different folder using the --folder-name or --folder-id parameter.

To update a ZooKeeper host configuration:

  1. View the description of the CLI command to update the cluster:

    yc managed-clickhouse cluster update --help
    
  2. Request a list of available host classes (the ZONE IDS column specifies the availability zones where you can select the appropriate class):

    yc managed-clickhouse resource-preset list
    
    +-----------+--------------------------------+-------+----------+
    |    ID     |            ZONE IDS            | CORES |  MEMORY  |
    +-----------+--------------------------------+-------+----------+
    | s1.micro  | ru-central1-a, ru-central1-b,  |     2 | 8.0 GB   |
    |           | ru-central1-d                  |       |          |
    | ...                                                           |
    +-----------+--------------------------------+-------+----------+
    
  3. Specify the new ZooKeeper host class and storage size in the cluster update command:

    yc managed-clickhouse cluster update <cluster_name_or_ID> \
       --zookepeer-resource-preset=<host_class> \
       --zookeeper-disk-size=<storage_size_in_GB>
    

With Terraform, you can quickly create a cloud infrastructure in Yandex Cloud and manage it using configuration files. These files store the infrastructure description written in HashiCorp Configuration Language (HCL). If you change the configuration files, Terraform automatically detects which part of your configuration is already deployed, and what should be added or removed.

Terraform is distributed under the Business Source License. The Yandex Cloud provider for Terraform is distributed under the MPL-2.0 license.

For more information about the provider resources, see the documentation on the Terraform website or mirror website.

To change ZooKeeper host settings:

  1. Open the current Terraform configuration file with an infrastructure plan.

    For more information about creating this file, see Creating clusters.

  2. In the ZooKeeper configuration section, specify the new host class and storage size.

    ZooKeeper host requirements:

    • Minimum host class: b1.medium.
    • The minimum storage size is 10 GB.
    resource "yandex_mdb_clickhouse_cluster" "<cluster_name>" {
      ...
      zookeeper {
        resources {
          resource_preset_id = "<host_class>"
          disk_type_id       = "network-ssd"
          disk_size          = <storage_size_in_GB>
        }
      }
      ...
    }
    
  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 the Terraform provider documentation.

Time limits

A Terraform provider sets the timeout for Managed Service for ClickHouse® cluster operations:

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

Operations exceeding the set timeout are interrupted.

How do I change these limits?

Add the timeouts block to the cluster description, for example:

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 put it into the environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Request a list of available host classes:

    1. Use the ResourcePreset.List method and send the following request, e.g., via cURL:

      curl \
          --request GET \
          --header "Authorization: Bearer $IAM_TOKEN" \
          --url 'https://mdb.api.cloud.yandex.net/managed-clickhouse/v1/resourcePresets'
      
    2. View the server response to make sure the request was successful.

  3. Change the host class and storage size:

    1. Use the Cluster.Update method and send the following request, e.g., via cURL:

      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>' \
          --data '{
                    "updateMask": "configSpec.zookeeper.resources.resourcePresetId,configSpec.zookeeper.resources.diskSize",
                    "configSpec": {
                      "zookeeper": {
                        "resources": {
                          "resourcePresetId": "<host_class>",
                          "diskSize": "<storage_size_in_GB>"
                        }
                      }
                    }
                  }'
      

      Where:

      • updateMask: List of parameters to update as a single string, separated by commas.

        Specify the relevant parameters:

        • configSpec.zookeeper.resources.resourcePresetId: To change the ZooKeeper host class.
        • configSpec.zookeeper.resources.diskSize: To change ZooKeeper storage size.
      • configSpec.zookeeper.resources.resourcePresetId: Host class ID.

      • configSpec.zookeeper.resources.diskSize: Storage size in GB.

      You can request the cluster ID with the list of clusters in the folder. The list of available host classes with their IDs came to you earlier.

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

  1. Get an IAM token for API authentication and put it into the 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. Request a list of available host classes:

    1. Use the ResourcePresetService/List call and send the following request, e.g., via gRPCurl:

      grpcurl \
          -format json \
          -import-path ~/cloudapi/ \
          -import-path ~/cloudapi/third_party/googleapis/ \
          -proto ~/cloudapi/yandex/cloud/mdb/clickhouse/v1/resource_preset_service.proto \
          -rpc-header "Authorization: Bearer $IAM_TOKEN" \
          mdb.api.cloud.yandex.net:443 \
          yandex.cloud.mdb.clickhouse.v1.ResourcePresetService.List
      
    2. View the server response to make sure the request was successful.

  4. Change the host class and storage size:

    1. Use the ClusterService.Update call and send the following request, e.g., via gRPCurl:

      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>",
                "update_mask": {
                  "paths": [
                    "config_spec.zookeeper.resources.resource_preset_id",
                    "config_spec.zookeeper.resources.disk_size"
                  ]
                },
                "config_spec": {
                  "zookeeper": {
                    "resources": {
                      "resource_preset_id": "<host_class>",
                      "disk_size": "<storage_size_in_GB>"
                    }
                  }
                }
              }' \
          mdb.api.cloud.yandex.net:443 \
          yandex.cloud.mdb.clickhouse.v1.ClusterService.Update
      

      Where:

      • update_mask: List of parameters to update as an array of paths[] strings.

        Specify the relevant parameters:

        • config_spec.zookeeper.resources.resource_preset_id: To change the ZooKeeper host class.
        • config_spec.zookeeper.resources.disk_size: To change storage size.
      • config_spec.zookeeper.resources.resource_preset_id: Host class ID.

      • config_spec.zookeeper.resources.disk_size: Storage size in GB.

      You can request the cluster ID with the list of clusters in the folder. The list of available host classes with their IDs came to you earlier.

  5. View the server response to make sure the request was successful.

Restarting a ZooKeeper hostRestarting a ZooKeeper host

You may need to restart hosts to promptly address such issues as the following:

  • Resource overrun
  • Memory leak
  • Deadlock between requests
  • Unresponsive ClickHouse® operations and internal processes

To restart a host:

Management console
CLI
REST API
gRPC API
  1. Go to the folder page and select Managed Service for ClickHouse.
  2. Click the cluster name and go to the Hosts tab.
  3. In the host's row, click and select Restart.
  4. Confirm the host restart.

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

The folder specified when creating the CLI profile is used by default. To change the default folder, use the yc config set folder-id <folder_ID> command. You can specify a different folder using the --folder-name or --folder-id parameter.

To restart a host, run this command:

yc managed-clickhouse host restart <host_name> \
   --cluster-name=<cluster_name>

You can request the host name with a list of cluster hosts, and the cluster name, with a list of clusters in the folder.

  1. Get an IAM token for API authentication and put it into the environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Use the Cluster.RestartHosts method and send the following request, e.g., via cURL:

    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>/hosts:restartHosts' \
        --data '{
                  "hostNames": [
                    <list_of_host_names>
                  ]
                }'
    

    Where hostNames is an array of strings. Each string is the name of a host to restart. You can request host names with a list of hosts in the cluster.

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

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

  1. Get an IAM token for API authentication and put it into the 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. Use the ClusterService.RestartHosts call and send the following request, e.g., via gRPCurl:

    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>",
                "host_names": [
                  <list_of_host_names>
                ]
            }' \
        mdb.api.cloud.yandex.net:443 \
        yandex.cloud.mdb.clickhouse.v1.ClusterService.RestartHosts
    

    Where host_names is an array of strings. Each string is the name of a host to restart. You can request host names with a list of hosts in the cluster.

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

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

Converting non-replicated tables to replicatedConverting non-replicated tables to replicated

To automatically convert non-replicated MergeTree tables to replicated ReplicatedMergeTree tables, add ZooKeeper hosts with table conversion enabled.

For more information, see Adding ZooKeeper hosts and the ClickHouse® documentation.

Removing a ZooKeeper hostRemoving a ZooKeeper host

Warning

If ZooKeeper hosts have already been created in the cluster, you cannot delete them completely: a cluster will always have at least three ZooKeeper hosts.

Management console
CLI
Terraform
REST API
gRPC API
  1. In the management console, navigate to the folder page and select Managed Service for ClickHouse.
  2. Click the name of the cluster you need and select the Hosts tab.
  3. Hover over the host's row and click .
  4. In the window that opens, click Delete.

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

The folder specified when creating the CLI profile is used by default. To change the default folder, use the yc config set folder-id <folder_ID> command. You can specify a different folder using the --folder-name or --folder-id parameter.

To remove a host from the cluster, run:

yc managed-clickhouse hosts delete <host_name> \
  --cluster-name=<cluster_name>

You can request the host name with the list of cluster hosts, and the cluster name, with the list of clusters in the folder.

With Terraform, you can quickly create a cloud infrastructure in Yandex Cloud and manage it using configuration files. These files store the infrastructure description written in HashiCorp Configuration Language (HCL). If you change the configuration files, Terraform automatically detects which part of your configuration is already deployed, and what should be added or removed.

Terraform is distributed under the Business Source License. The Yandex Cloud provider for Terraform is distributed under the MPL-2.0 license.

For more information about the provider resources, see the documentation on the Terraform website or mirror website.

To delete a ZooKeeper host:

  1. Open the current Terraform configuration file with an infrastructure plan.

    For more information about creating this file, see Creating clusters.

  2. Delete the ZOOKEEPER type host block 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 the Terraform provider documentation.

Time limits

A Terraform provider sets the timeout for Managed Service for ClickHouse® cluster operations:

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

Operations exceeding the set timeout are interrupted.

How do I change these limits?

Add the timeouts block to the cluster description, for example:

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 put it into the environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Use the Cluster.DeleteHosts method and send the following request, e.g., via cURL:

    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>/hosts:batchDelete' \
        --data '{
                  "hostNames": [
                    <list_of_host_names>
                  ]
                }'
    

    Where hostNames is an array of strings. Each string is the name of a host to delete. You can request host names with a list of hosts in the cluster.

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

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

  1. Get an IAM token for API authentication and put it into the 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. Use the ClusterService.DeleteHosts call and send the following request, e.g., via gRPCurl:

    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>",
                "host_names": [
                  <list_of_host_names>
                ]
            }' \
        mdb.api.cloud.yandex.net:443 \
        yandex.cloud.mdb.clickhouse.v1.ClusterService.DeleteHosts
    

    Where host_names is an array of strings. Each string is the name of a host to delete. You can request host names with a list of hosts in the cluster.

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

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

ClickHouse® is a registered trademark of ClickHouse, Inc.

Was the article helpful?

Previous
Managing ClickHouse® hosts
Next
Migrating hosts to a different availability zone
Yandex project
© 2025 Yandex.Cloud LLC