Managing ZooKeeper hosts
ZooKeeper is a coordination system you can use to distribute queries among ClickHouse® hosts for data replication. For successful replication, your 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, the system will automatically add three ZooKeeper hosts 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 do the following with 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.
- Delete a host.
Getting a list of cluster hosts
- In the management console
, select the folder the cluster is in. - Go to Managed Service for ClickHouse.
- Click the cluster name and select the Hosts 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 cluster hosts, run this 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 get the cluster name with the list of clusters in the folder.
-
Get an IAM token for API authentication and put it in an environment variable:
export IAM_TOKEN="<IAM_token>" -
Call the Cluster.ListHosts 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>/hosts'You can get the cluster ID with the list of clusters in the folder.
-
View the server response to make sure your request was successful.
-
Get an IAM token for API authentication and save it as an environment variable:
export IAM_TOKEN="<IAM_token>" -
Clone the cloudapi
repository:cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapiBelow, we assume that the repository contents reside in the
~/cloudapi/directory. -
Call the ClusterService.ListHosts 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.ListHostsYou can get the cluster ID with the list of clusters in the folder.
-
View the server response to make sure your request was successful.
Adding ZooKeeper hosts
Note
Intel Broadwell is not supported in the ru-central1-d availability zone.
-
In the management console
, select the folder the cluster is in. -
Navigate to the Managed Service for ClickHouse service.
-
Click the name of your cluster and select the Hosts tab.
-
At the top right, click Set up coordinator service.
-
Specify the host class.
-
Configure the storage.
-
Change the ZooKeeper host settings, if required. To do this, hover over the relevant host row and click
. -
To convert non-replicated tables to replicated ones, enable Convert non-replicated tables. This will automatically convert MergeTree
tables to ReplicatedMergeTree ones.Warning
Once this option is enabled, you cannot disable it.
-
Click Save changes.
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 add ZooKeeper hosts to a cluster:
-
View the description of the CLI command for adding ZooKeeper hosts:
yc managed-clickhouse cluster add-zookeeper --help -
Run this command to add hosts with the default configurations:
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-bIf the cluster network contains exactly three subnets, one per availability zone, you do not have to explicitly specify subnets for the hosts: Managed Service for ClickHouse® will automatically distribute hosts across these subnets.
To convert non-replicated tables to replicated, add the
--convert-tables-to-replicatedparameter to the command. This will automatically convert MergeTree tables to ReplicatedMergeTree ones.Warning
Once this option is enabled, you cannot disable it.
You can get the cluster name from the list of clusters in your folder.
With Terraform
Terraform is distributed under the Business Source License
For more information about the provider resources, see the relevant documentation on the Terraform
To add ZooKeeper hosts to a cluster:
-
Open the current Terraform configuration file describing your infrastructure.
To learn how to create this file, see Creating a cluster.
-
Make sure the configuration file describes three subnets, one per 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>" ] } -
Add a ZooKeeper configuration section and at least three
ZOOKEEPER-typehostsections to the ClickHouse® cluster description.The ZooKeeper host requirements are as follows:
- Each availability zone must have at least one host.
- Minimum host class:
b1.medium. - Disk type:
network-ssd. - Minimum storage size: 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_idis the host class,b1.mediumor higher. -
Make sure the settings are correct.
-
In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.
-
Run this command:
terraform validateTerraform will show any errors found in your configuration files.
-
-
Confirm updating the resources.
-
Run this command to view the planned changes:
terraform planIf 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.
-
If everything looks correct, apply the changes:
-
Run this command:
terraform apply -
Confirm updating the resources.
-
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
}
}
-
Get an IAM token for API authentication and put it in an environment variable:
export IAM_TOKEN="<IAM_token>" -
Call the Cluster.AddZookeeper 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>: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 of settings for the new hosts. Each 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: Host type,ZOOKEEPER.zoneId: Availability zone.subnetId: Subnet ID.
-
convertTablesToReplicated: Converting non-replicated tables to replicated ones,trueorfalse. This will automatically convert MergeTree tables to ReplicatedMergeTree ones.Warning
Once this option is enabled, you cannot disable it.
You can get the cluster ID with the list of clusters in the folder.
-
-
View the server response to make sure your request was successful.
-
Get an IAM token for API authentication and put it in an environment variable:
export IAM_TOKEN="<IAM_token>" -
Clone the cloudapi
repository:cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapiBelow, we assume that the repository contents reside in the
~/cloudapi/directory. -
Call the ClusterService.AddZookeeper 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>", "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.AddZookeeperWhere:
-
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 of settings for the new hosts. Each 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: Host type,ZOOKEEPER.zone_id: Availability zone.subnet_id: Subnet ID.
-
convert_tables_to_replicated: Converting non-replicated tables to replicated ones,trueorfalse. This will automatically convert MergeTree tables to ReplicatedMergeTree ones.Warning
Once this option is enabled, you cannot disable it.
You can get the cluster ID with the list of clusters in the folder.
-
-
View the server response to make sure your request was successful.
Note
ZooKeeper hosts have the following configuration by default:
- Host class:
b2.medium. - Network SSD storage (
network-ssd): 10 GB.
Updating ZooKeeper host settings
After creating ZooKeeper hosts, you can change their class, storage size, and disk type.
We recommend changing the host class only when your cluster has no active workload.
Warning
When you change the disk type, the cluster hosts get recreated. The system automatically saves the replicated tables data. The non-replicated tables data will be lost. Before changing the disk type, either convert non-replicated tables to replicated ones or create a backup.
Note
To change the disk type to local-ssd, contact support
The minimum number of cores per ZooKeeper host depends on the total number of cores on ClickHouse® hosts. To learn more, see Replication.
- In the management console
, select the folder the cluster is in. - Navigate to the Managed Service for ClickHouse service.
- Select your cluster and click Edit in the top panel.
- Under ZooKeeper host class, select the platform, VM type, and required ZooKeeper host class.
- Under ZooKeeper storage size, set the storage size and disk type for ZooKeeper hosts.
- Click Save changes.
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 ZooKeeper host configuration:
-
View the description of the CLI command for updating a cluster:
yc managed-clickhouse cluster update --help -
Request a list of available host classes. The
ZONE IDScolumn lists the availability zones where the relevant class can be selected: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 | | | | ... | +-----------+--------------------------------+-------+----------+ -
In the update cluster command, provide the new class, disk type, and storage size for your ZooKeeper host:
yc managed-clickhouse cluster update <cluster_name_or_ID> \ --zookepeer-resource-preset=<host_class> \ --zookeeper-disk-size=<storage_size_in_GB> \ --zookeeper-disk-type=<disk_type>You can get the cluster name and ID with the list of clusters in the folder.
With Terraform
Terraform is distributed under the Business Source License
For more information about the provider resources, see the relevant documentation on the Terraform
To update the ZooKeeper host settings:
-
Open the current Terraform configuration file describing your infrastructure.
To learn how to create this file, see Creating a cluster.
-
In the ZooKeeper configuration section, specify the new host class, disk type, and storage size.
The ZooKeeper host requirements are as follows:
- Minimum host class:
b1.medium. - Minimum storage size: 10 GB.
resource "yandex_mdb_clickhouse_cluster" "<cluster_name>" { ... zookeeper { resources { resource_preset_id = "<host_class>" disk_type_id = "<disk_type>" disk_size = <storage_size_in_GB> } } ... } - Minimum host class:
-
Make sure the settings are correct.
-
In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.
-
Run this command:
terraform validateTerraform will show any errors found in your configuration files.
-
-
Confirm updating the resources.
-
Run this command to view the planned changes:
terraform planIf 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.
-
If everything looks correct, apply the changes:
-
Run this command:
terraform apply -
Confirm updating the resources.
-
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
}
}
-
Get an IAM token for API authentication and put it in an environment variable:
export IAM_TOKEN="<IAM_token>" -
Get the list of available host classes:
-
Call the ResourcePreset.List 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/resourcePresets' -
Check the server response to make sure your request was successful.
-
-
Update the host class, disk type, and storage size:
-
Call the Cluster.Update 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
updateMaskparameter 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.diskTypeId,configSpec.zookeeper.resources.diskSize", "configSpec": { "zookeeper": { "resources": { "resourcePresetId": "<host_class>", "diskTypeId": "<disk_type>", "diskSize": "<storage_size_in_GB>" } } } }'Where:
-
updateMask: Comma-separated string of settings you want to update.Specify the relevant parameters:
configSpec.zookeeper.resources.resourcePresetId: To change the ZooKeeper host class.configSpec.zookeeper.resources.diskTypeId: To change the disk type for ZooKeeper hosts.configSpec.zookeeper.resources.diskSize: To change the ZooKeeper storage size.
-
configSpec.zookeeper.resources.resourcePresetId: Host class ID. -
configSpec.zookeeper.resources.diskTypeId: Disk type. -
configSpec.zookeeper.resources.diskSize: Storage size, in GB.
You can get the cluster ID from the list of clusters in your folder. Earlier, you already obtained the list of available host classes with their IDs.
-
-
-
Check the server response to make sure your request was successful.
-
Get an IAM token for API authentication and put it in an environment variable:
export IAM_TOKEN="<IAM_token>" -
Clone the cloudapi
repository:cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapiBelow, we assume that the repository contents reside in the
~/cloudapi/directory. -
Get the list of available host classes:
-
Call the ResourcePresetService.List 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/resource_preset_service.proto \ -rpc-header "Authorization: Bearer $IAM_TOKEN" \ mdb.api.cloud.yandex.net:443 \ yandex.cloud.mdb.clickhouse.v1.ResourcePresetService.List -
Check the server response to make sure your request was successful.
-
-
Update the host class, disk type, and storage size:
-
Call the ClusterService.Update 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_maskparameter as an array ofpaths[]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_type_id", "config_spec.zookeeper.resources.disk_size" ] }, "config_spec": { "zookeeper": { "resources": { "resource_preset_id": "<host_class>", "disk_type_id": "<disk_type>", "disk_size": "<storage_size_in_GB>" } } } }' \ mdb.api.cloud.yandex.net:443 \ yandex.cloud.mdb.clickhouse.v1.ClusterService.UpdateWhere:
-
update_mask: List of parameters to update as an array of strings (paths[]).Specify the relevant parameters:
config_spec.zookeeper.resources.resource_preset_id: To change the ZooKeeper host class.config_spec.zookeeper.resources.disk_type_id: To change the disk type for ZooKeeper hosts.config_spec.zookeeper.resources.disk_size: To change the ZooKeeper storage size.
-
config_spec.zookeeper.resources.resource_preset_id: Host class ID. -
config_spec.zookeeper.resources.disk_type_id: Disk type. -
config_spec.zookeeper.resources.disk_size: Storage size, in GB.
You can get the cluster ID from the list of clusters in your folder. Earlier, you already obtained the list of available host classes with their IDs.
-
-
-
View the server response to make sure your request was successful.
Restarting a ZooKeeper host
You may need to restart hosts to promptly address such issues as:
- Resource overutilization
- Memory leak
- Request deadlock
- Unresponsive ClickHouse® operations and internal processes
To restart a single host:
- In the management console
, select the folder the cluster is in. - Go to Managed Service for ClickHouse.
- Click the cluster name and navigate to the Hosts tab.
- In the host row, click
and select Restart. - In the window that opens, enable I am restarting host and click Confirm.
To restart multiple hosts in one go:
- In the management console
, select the folder the cluster is in. - Go to Managed Service for ClickHouse.
- Click the cluster name and navigate to the Hosts tab.
- Select the hosts you want to restart and click Restart at the bottom of the screen.
- In the window that opens, click Confirm.
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 restart one or multiple hosts, run the command below providing their names. Use the space character as a separator.
Here is the command to restart a single host:
yc managed-clickhouse host restart <host_name> \
--cluster-name=<cluster_name>
You can get the host name with the list of cluster hosts, and the cluster name, with the list of clusters in the folder.
-
Get an IAM token for API authentication and save it as an environment variable:
export IAM_TOKEN="<IAM_token>" -
Call the Cluster.RestartHosts 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>/hosts:restartHosts' \ --data '{ "hostNames": [ <list_of_host_names> ] }'Where
hostNamesis an array of strings. Each string is the name of the host to restart. You can get the host names with the list of hosts in the cluster.You can get the cluster ID with the list of clusters in the folder.
-
View the server response to make sure your request was successful.
-
Get an IAM token for API authentication and save it as an environment variable:
export IAM_TOKEN="<IAM_token>" -
Clone the cloudapi
repository:cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapiBelow, we assume that the repository contents reside in the
~/cloudapi/directory. -
Call the ClusterService.RestartHosts 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>", "host_names": [ <list_of_host_names> ] }' \ mdb.api.cloud.yandex.net:443 \ yandex.cloud.mdb.clickhouse.v1.ClusterService.RestartHostsWhere
host_namesis an array of strings. Each string is the name of the host to restart. You can get the host names with the list of hosts in the cluster.You can get the cluster ID with the list of clusters in the folder.
-
View the server response to make sure your request was successful.
Converting non-replicated tables to replicated ones
To automatically convert non-replicated MergeTree
For more information, see Adding ZooKeeper hosts and this ClickHouse® guide
Deleting 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.
- In the management console
, select the folder the cluster is in. - Navigate to the Managed Service for ClickHouse service.
- Click the name of your cluster and select the Hosts tab.
- Hover over the relevant host row and click
. - In the window that opens, click 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 host from a cluster, run this command:
yc managed-clickhouse hosts delete <host_name> \
--cluster-name=<cluster_name>
You can get the host name with the list of cluster hosts, and the cluster name, with the list of clusters in the folder.
With Terraform
Terraform is distributed under the Business Source License
For more information about the provider resources, see the relevant documentation on the Terraform
To delete a ZooKeeper host:
-
Open the current Terraform configuration file describing your infrastructure.
To learn how to create this file, see Creating a cluster.
-
Delete the
ZOOKEEPER-typehostsection from the Managed Service for ClickHouse® cluster description. -
Make sure the settings are correct.
-
In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.
-
Run this command:
terraform validateTerraform will show any errors found in your configuration files.
-
-
Type
yesand press Enter.-
Run this command to view the planned changes:
terraform planIf 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.
-
If everything looks correct, apply the changes:
-
Run this command:
terraform apply -
Confirm updating the resources.
-
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
}
}
-
Get an IAM token for API authentication and put it in an environment variable:
export IAM_TOKEN="<IAM_token>" -
Call the Cluster.DeleteHosts 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>/hosts:batchDelete' \ --data '{ "hostNames": [ <list_of_host_names> ] }'Where
hostNamesis an array of strings. Each string is the name of a host to delete. You can get the host names with the list of hosts in the cluster.You can get the cluster ID with the list of clusters in the folder.
-
View the server response to make sure your request was successful.
-
Get an IAM token for API authentication and put it in an environment variable:
export IAM_TOKEN="<IAM_token>" -
Clone the cloudapi
repository:cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapiBelow, we assume that the repository contents reside in the
~/cloudapi/directory. -
Call the ClusterService.DeleteHosts 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>", "host_names": [ <list_of_host_names> ] }' \ mdb.api.cloud.yandex.net:443 \ yandex.cloud.mdb.clickhouse.v1.ClusterService.DeleteHostsWhere
host_namesis an array of strings. Each string is the name of a host to delete. You can get the host names with the list of hosts in the cluster.You can get the cluster ID with the list of clusters in the folder.
-
View the server response to make sure your request was successful.
ClickHouse® is a registered trademark of ClickHouse, Inc