ClickHouse® cluster maintenance
You can manage maintenance of a Yandex Managed Service for ClickHouse® cluster.
Getting a list of maintenance jobs
- Go to Managed Service for ClickHouse.
- Click the name of your cluster and select the Maintenance tab.
To view maintenance jobs with a specific status, click Status above the maintenance list and select the status you want from the drop-down menu. You can also find a maintenance job by its ID or job name using the search field above the list.
Click an ID to see how the maintenance job affects cluster availability. Look up Task details to see how the maintenance job affects users.
Getting maintenance-related cluster logs
- Navigate to the Managed Service for ClickHouse service.
- Click the name of your cluster and select the Maintenance tab.
- Click the ID of the maintenance job you need.
- Click Task logs.
Postpone the planned maintenance
Maintenance jobs with the Planned status have a specific scheduled date and time specified in the Start date column. You can reschedule them to a new date and time if needed.
To reschedule maintenance for a new date and time:
- Navigate to the Managed Service for ClickHouse service.
- Click the name of your cluster and select the Maintenance tab.
- Click
next to the maintenance job with the Planned status. - In the drop-down menu, select
Postpone. - In the window that opens:
- To postpone the maintenance until the next available window, click Next window and then Reschedule.
- To reschedule maintenance to a specific UTC date and time, click Choose date (UTC), then select a new date and time interval and click Reschedule.
If you do not have the Yandex Cloud CLI yet, install and initialize it.
The folder used by default is the one specified when creating the CLI 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 options.
To reschedule maintenance for a new date and time:
-
See the description of the CLI command for rescheduling maintenance :
yc managed-clickhouse cluster reschedule-maintenance --help -
To reschedule to the next available window, run this command using the
next-available-windowreschedule type. To reschedule to a specific date and time, use thespecific-timereschedule type:yc managed-clickhouse cluster reschedule-maintenance <cluster_name_or_ID> \ --reschedule-type <reschedule_type> \ --delayed-until <timestamp>The timestamp must be in one of the following formats:
- RFC-3339
HH:MM:SS- Maintenance time offset in hours and minutes.
For example,
2006-01-02T15:04:05Z,15:04:05,2h, or3h30m ago. With thenext-available-windowreschedule type, you do not need to specify--delayed-until.You can get the cluster name and ID with the list of clusters in the folder.
- RFC-3339
To reschedule maintenance for a new date and time:
-
Get an IAM token for API authentication and put it into an environment variable:
export IAM_TOKEN="<IAM_token>" -
Call the Cluster.RescheduleMaintenance 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>:rescheduleMaintenance' \ --data '{ "rescheduleType": <reschedule_type>, "delayedUntil": <timestamp> }'Where
rescheduleTypeis the reschedule type that can be one of the following values:NEXT_AVAILABLE_WINDOW: Postpone maintenance until the next available window.SPECIFIC_TIME: Move the maintenance to a specific date and time.
The timestamp must be in RFC-3339
format, e.g.,2006-01-02T15:04:05Z. When selecting theNEXT_AVAILABLE_WINDOWreschedule type, you do not need to specifydelayedUntil.You can get the cluster ID from the folder’s cluster list.
-
Check the server response to make sure your request was successful.
-
Get an IAM token for API authentication and put it into 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.RescheduleMaintenance 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>", "reschedule_type": <reschedule_type>, "delayed_until": <timestamp> }' \ mdb.api.cloud.yandex.net:443 \ yandex.cloud.mdb.clickhouse.v1.ClusterService.RescheduleMaintenanceWhere
reschedule_typeis the reschedule type that can be one of the following values:NEXT_AVAILABLE_WINDOW: Move the maintenance to the nearest window.SPECIFIC_TIME: Move the maintenance to a specific date and time.
The timestamp must be in RFC-3339
format, e.g.,2006-01-02T15:04:05Z. When selecting theNEXT_AVAILABLE_WINDOWreschedule type, you do not need to specifydelayed_until.You can request the cluster ID with the list of clusters in the folder.
-
Check the server response to make sure your request was successful.
Starting scheduled maintenance immediately
If necessary, you can run a maintenance job with the Planned status immediately, prior to the time specified in the Start date column.
To run a scheduled cluster maintenance job immediately:
- Navigate to the Managed Service for ClickHouse service.
- Click the name of your cluster and select the Maintenance tab.
- Click
next to the maintenance job you need. - In the drop-down menu, select
Carry out now.
If you do not have the Yandex Cloud CLI yet, install and initialize it.
The folder used by default is the one specified when creating the CLI 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 options.
To run a scheduled cluster maintenance job immediately:
-
See the description of the CLI command for rescheduling maintenance :
yc managed-clickhouse cluster reschedule-maintenance --help -
Run this command using the
immediatereschedule type:yc managed-clickhouse cluster reschedule-maintenance <cluster_name_or_ID> \ --reschedule-type immediateYou can get the cluster name and ID with the list of clusters in the folder.
To run a scheduled cluster maintenance job immediately:
-
Get an IAM token for API authentication and put it into an environment variable:
export IAM_TOKEN="<IAM_token>" -
Call the Cluster.RescheduleMaintenance 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>:rescheduleMaintenance' \ --data '{ "rescheduleType": "IMMEDIATE" }'You can request the cluster ID with the list of clusters in the folder.
-
Check the server response to make sure your request was successful.
-
Get an IAM token for API authentication and put it into 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.RescheduleMaintenance 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>", "reschedule_type": "IMMEDIATE" }' \ mdb.api.cloud.yandex.net:443 \ yandex.cloud.mdb.clickhouse.v1.ClusterService.RescheduleMaintenanceYou can request the cluster ID with the list of clusters in the folder.
-
Check the server response to make sure your request was successful.
Configuring a maintenance window
By default, maintenance can be scheduled for any time. You can choose a specific day of the week and hour to schedule maintenance. For example, you can choose the time when the cluster is least busy.
Warning
If a scheduled maintenance does not fall within the new interval, it will be automatically canceled.
- Navigate to the Managed Service for ClickHouse service.
- Click the name of your cluster and select the Maintenance tab.
- Click
Configure the maintenance window. - In the window that opens:
- To allow maintenance at any time, select arbitrary, which is also the default option.
- To allow weekly maintenance at a specific time, select by schedule and specify the weekday and hour in UTC.
If you do not have the Yandex Cloud CLI yet, install and initialize it.
The folder used by default is the one specified when creating the CLI 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 options.
-
See the description of the CLI command for updating the maintenance window:
yc managed-clickhouse cluster update --help -
Run this command:
yc managed-clickhouse cluster update <cluster_name_or_ID> \ --maintenance-window type=<maintenance_type>,` `day=<day_of_week>,` `hour=<hour>Where
typeis the maintenance type:anytime: At any time (default).weekly: On a schedule. For this value, also specify the following:day: Day of week, i.e.,MON,TUE,WED,THU,FRI,SAT, orSUN.hour: Hour of day (UTC), from1to24.
You can get the cluster name and ID with the list of clusters in the folder.
-
Open the current Terraform configuration file describing your infrastructure.
For more on how to create this file, see Creating a cluster.
For a complete list of configurable Managed Service for ClickHouse® cluster fields, see this Terraform provider guide.
-
To set up the maintenance window that will also apply to stopped clusters, add the
maintenance_windowsection to the cluster description:resource "yandex_mdb_clickhouse_cluster" "<cluster_name>" { ... maintenance_window { type = "<maintenance_type>" day = "<day_of_week>" hour = <hour> } ... }Where:
type: Maintenance type. The possible values include:ANYTIME: AnytimeWEEKLY: On a schedule
day: Day of week for theWEEKLYtype, i.e.,MON,TUE,WED,THU,FRI,SAT, orSUN.hour: UTC hour for theWEEKLYtype, from1to24.
-
Validate your configuration.
-
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.
-
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
timeoutssection 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 into an environment variable:
export IAM_TOKEN="<IAM_token>" -
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": "maintenanceWindow", "maintenanceWindow": { "weeklyMaintenanceWindow": { "day": "<day_of_week>", "hour": "<hour>" } } }'Where:
-
updateMask: Comma-separated string of settings to update.Here, we provide only one setting.
-
maintenanceWindow: Maintenance window settings, including for stopped clusters. InmaintenanceWindow, provide one of the two values:-
anytime: Maintenance can be scheduled for any time. -
weeklyMaintenanceWindow: Maintenance can only be scheduled for a specific day of week and hour:day: Day of week inDDDformat, i.e.,MON,TUE,WED,THU,FRI,SAT, orSUN.hour: Time of day (UTC) inHHformat, from1to24.
-
You can request the cluster ID with the list of clusters in the folder.
-
-
Check the server response to make sure your request was successful.
-
Get an IAM token for API authentication and put it into 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.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": ["maintenance_window"] }, "maintenance_window": { "weekly_maintenance_window": { "day": "<day_of_week>", "hour": "<hour>" } } }' \ mdb.api.cloud.yandex.net:443 \ yandex.cloud.mdb.clickhouse.v1.ClusterService.UpdateWhere:
-
update_mask: List of settings you want to update as an array of strings (paths[]).Here, we provide only one setting.
-
maintenance_window: Maintenance window settings, including for stopped clusters. Inmaintenance_window, provide one of the two values:-
anytime: Maintenance can be scheduled for any time. -
weekly_maintenance_window: Maintenance can only be scheduled for a specific day of week and hour:day: Day of week inDDDformat, i.e.,MON,TUE,WED,THU,FRI,SAT, orSUN.hour: Time of day (UTC) inHHformat, from1to24.
-
You can request the cluster ID with the list of clusters in the folder.
-
-
Check the server response to make sure your request was successful.
ClickHouse® is a registered trademark of ClickHouse, Inc