ClickHouse® version upgrade
You can update the ClickHouse® version used by the cluster to any of the supported Managed Service for ClickHouse® versions; however, switching from versions lower than 23.8 to 23.8 or higher is performed in steps. For example, the sequence for upgrading Managed Service for ClickHouse® from version 22.8 to 24.3 is as follows: 22.8 → 23.3 → 23.8 → 24.3.
To learn more about updates within a single version and host maintenance, see Maintenance.
List of available versions
In the management console
If you do not have the Yandex Cloud command line interface yet, install and initialize it.
The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name
or --folder-id
parameter.
To get a list of available versions, run the following command:
yc managed-clickhouse version list
-
Get an IAM token for API authentication and put it into the environment variable:
export IAM_TOKEN="<IAM_token>"
-
Use the Versions.list method and make a request, e.g., via cURL
:curl \ --request GET \ --header "Authorization: Bearer $IAM_TOKEN" \ --url 'https://mdb.api.cloud.yandex.net/managed-clickhouse/v1/versions'
-
View the server response to make sure the request was successful.
-
Get an IAM token for API authentication and put it into the environment variable:
export IAM_TOKEN="<IAM_token>"
-
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. -
Use the VersionsService/List call and make a request, e.g., via gRPCurl
:grpcurl \ -format json \ -import-path ~/cloudapi/ \ -import-path ~/cloudapi/third_party/googleapis/ \ -proto ~/cloudapi/yandex/cloud/mdb/clickhouse/v1/versions_service.proto \ -rpc-header "Authorization: Bearer $IAM_TOKEN" \ mdb.api.cloud.yandex.net:443 \ yandex.cloud.mdb.clickhouse.v1.VersionsService.List
-
View the server response to make sure the request was successful.
Before a version upgrade
Make sure this does not affect your applications:
- See the ClickHouse® changelog
to check how updates might affect your applications. - Try upgrading the version on a test cluster. You can deploy it from a backup of the main cluster. In this case, you will only recover MergeTree tables.
- Create a backup of the main cluster directly before the version upgrade.
Updating the version
- In the management console
, open the Managed Service for ClickHouse page in the folder where you want to update the ClickHouse® version. - In the list of clusters, select the one to change.
- Click Edit.
- Under Basic parameters, select the appropriate version in the Version field.
- Click Save changes.
When the change starts, the cluster status will switch to UPDATING. Wait for the operation to complete and then check the cluster version.
If you do not have the Yandex Cloud command line interface yet, install and initialize it.
The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name
or --folder-id
parameter.
-
Get a list of your ClickHouse® clusters and view their versions:
yc managed-clickhouse cluster list +----------------------+------+-------------+---------+---------------------+--------+---------+ | ID | NAME | ENVIRONMENT | VERSION | CREATED AT | HEALTH | STATUS | +----------------------+------+-------------+---------+---------------------+--------+---------+ | c9qf1kmm0ebi******** | mych | PRODUCTION | 23.8 | 2024-06-06 10:23:22 | ALIVE | RUNNING | +----------------------+------+-------------+---------+---------------------+--------+---------+
-
Update the ClickHouse® version for any cluster as needed:
yc managed-clickhouse cluster update --id <cluster_ID> --version <ClickHouse®_version>
Specify the ClickHouse® version: 24.3, 24.8, 24.9 or 24.10.
When the update starts, the cluster status will switch to UPDATING. Wait for the operation to complete and then check the cluster version.
-
Open the current Terraform configuration file with an infrastructure plan.
For more information about creating this file, see Creating clusters.
-
To the Managed Service for ClickHouse® cluster description, add the
version
field or change its value if it is already there:resource "yandex_mdb_clickhouse_cluster" "<cluster_name>" { ... version = "<ClickHouse®_version>" }
Specify the ClickHouse® version: 24.3, 24.8, 24.9 or 24.10.
-
Make sure the settings are correct.
-
Using the command line, navigate to the folder that contains the up-to-date Terraform configuration files with an infrastructure plan.
-
Run the command:
terraform validate
If there are errors in the configuration files, Terraform will point to them.
-
-
Confirm updating the resources.
-
Run the command to view planned changes:
terraform plan
If the resource configuration descriptions are correct, the terminal will display a list of the resources to modify and their parameters. This is a test step. No resources are updated.
-
If you are happy with the planned changes, apply them:
-
Run the command:
terraform apply
-
Confirm the update of resources.
-
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
}
}
-
Get an IAM token for API authentication and put it into the environment variable:
export IAM_TOKEN="<IAM_token>"
-
Use the Cluster.update method and make a 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.version", "configSpec": { "version": "<ClickHouse®>_version" } }'
Where:
-
updateMask
: List of parameters to update as a single string, separated by commas.Here we specified just a single parameter,
configSpec.version
. -
configSpec.version
: target ClickHouse® version, 24.3, 24.8, 24.9 or 24.10.
You can request the cluster ID with the list of clusters in the folder.
-
-
View the server response to make sure the request was successful.
-
Get an IAM token for API authentication and put it into the environment variable:
export IAM_TOKEN="<IAM_token>"
-
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. -
Use the ClusterService/Update call and make a 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 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.version" ] }, "config_spec": { "version": "<ClickHouse®>_version" } }' \ mdb.api.cloud.yandex.net:443 \ yandex.cloud.mdb.clickhouse.v1.ClusterService.Update
Where:
-
update_mask
: List of parameters to update as an array ofpaths[]
strings.Here we specified just a single parameter,
config_spec.version
. -
config_spec.version
: target ClickHouse® version, 24.3, 24.8, 24.9 or 24.10.
You can request the cluster ID with the list of clusters in the folder.
-
-
View the server response to make sure the request was successful.
ClickHouse® is a registered trademark of ClickHouse, Inc