Apache Kafka® cluster maintenance
You can manage the technical maintenance of a Yandex Managed Service for Apache Kafka® cluster.
Getting the maintenance list
- Navigate to the folder dashboard and select Managed Service for Kafka.
- Click the cluster name and select the Technical maintenance tab.
To view maintenance events with a specific status, click Status above the maintenance list and select the status you want from the drop-down menu. To find a specific maintenance, enter its ID or task name in the field above the list of maintenances.
Getting cluster maintenance logs
- Navigate to the folder dashboard and select Managed Service for Kafka.
- Click the cluster name and select the Technical maintenance tab.
- Click the ID of the maintenance event you need.
- Click Task logs.
Postpone the planned maintenance
Maintenance sessions with the Planned status are scheduled for the date and time specified in the Start date column. You can reschedule them for a new date and time if needed.
To reschedule maintenance for a new date and time:
- Navigate to the folder dashboard and select Managed Service for Kafka.
- Click the cluster name and select the Technical maintenance tab.
- Click
next to the maintenance with the Planned status. - In the drop-down menu, select
Postpone. - In the window that opens, do the following:
- To postpone the maintenance until the next available window, click Next window and then Reschedule.
- To reschedule maintenance for a specific UTC date and time, click Choose date (UTC), then select a new date and time and click Reschedule.
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 reschedule maintenance for a new date and time:
-
See the description of the CLI command for rescheduling maintenance :
yc managed-kafka cluster reschedule-maintenance --help -
Run this command:
yc managed-kafka cluster reschedule-maintenance <cluster_name_or_ID> \ --reschedule-type <reschedule_type> \ --delayed-until <timestamp>Where:
-
reschedule-type: Reschedule type:next-available-window: Next available window.specific-time: Specific date and time.
-
delayed-until: Timestamp (do not use with thenext-available-windowreschedule type).The timestamp must be in one of the following formats:
- RFC-3339
. - HH:MM:SS.
- Relative time to postpone maintenance for.
Here are some examples:
2006-01-02T15:04:05Z,15:04:05,2h, or3h30m ago. - RFC-3339
You can get the cluster name and ID with the list of clusters in the folder.
-
To reschedule maintenance for a new date and time:
-
Save the token to an environment variable:
export IAM_TOKEN="<IAM_token>" -
Use the Cluster.rescheduleMaintenance 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-kafka/v1/clusters/<cluster_ID>:rescheduleMaintenance' \ --data '{ "rescheduleType": <reschedule_type>, "delayedUntil": <timestamp> }'Where:
-
rescheduleType: Reschedule type:NEXT_AVAILABLE_WINDOW: Next available window.SPECIFIC_TIME: Specific date and time.
-
delayedUntil: Timestamp in RFC-3339 format, e.g.,2006-01-02T15:04:05Z.Do not use this option with the
NEXT_AVAILABLE_WINDOWreschedule type.
You can get the cluster ID from the folder’s cluster list.
-
-
Check the server response to make sure your request was successful.
To reschedule a maintenance job to a new date and time:
-
Save the token to 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 the repository contents are stored in the
~/cloudapi/directory. -
Use the ClusterService.RescheduleMaintenance 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/kafka/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.kafka.v1.ClusterService.RescheduleMaintenanceWhere:
-
reschedule_type: Reschedule type:NEXT_AVAILABLE_WINDOW: Next available window.SPECIFIC_TIME: Specific date and time.
-
delayedUntil: Timestamp in RFC-3339 format, e.g.,2006-01-02T15:04:05Z.Do not use this option with the
NEXT_AVAILABLE_WINDOWreschedule type.
You can get the cluster ID from the folder’s cluster list.
-
-
Check the server response to make sure your request was successful.
Starting scheduled maintenance immediately
You can run a maintenance job with the Planned status immediately, prior to the time specified in the Start date column.
To start a scheduled maintenance job immediately, do the following:
- Navigate to the folder dashboard and select Managed Service for Kafka.
- Click the cluster name and select the Technical maintenance tab.
- Click
next to the maintenance job. - In the drop-down menu, select
Carry out now.
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 start a scheduled maintenance job immediately, do the following:
-
See the description of the CLI command for rescheduling maintenance :
yc managed-kafka cluster reschedule-maintenance --help -
Run this command using the
immediatereschedule type:yc managed-kafka 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 start a scheduled maintenance job immediately, do the following:
-
Save the token to an environment variable:
export IAM_TOKEN="<IAM_token>" -
Use the Cluster.rescheduleMaintenance 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-kafka/v1/clusters/<cluster_ID>:rescheduleMaintenance' \ --data '{ "rescheduleType": "IMMEDIATE" }'You can get the cluster ID from the folder’s cluster list.
-
Check the server response to make sure your request was successful.
To start a scheduled maintenance job immediately, do the following:
-
Save the token to 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 the repository contents are stored in the
~/cloudapi/directory. -
Use the ClusterService.RescheduleMaintenance 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/kafka/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.kafka.v1.ClusterService.RescheduleMaintenanceYou can get the cluster ID from the folder’s cluster list.
-
Check the server response to make sure your request was successful.
Configuring a maintenance window
By default, maintenance can take place at any time. To set a specific maintenance window, specify the day of the week and time interval. For example, you can schedule it for periods of lowest cluster load.
Warning
A scheduled maintenance job will be cancelled automatically if its time falls outside the specified interval.
- Navigate to the folder dashboard and select Managed Service for Kafka.
- Click the cluster name and select the Technical maintenance tab.
- Click
Configure the maintenance window. - In the window that opens, do the following:
- To allow maintenance at any time, select arbitrary, which is also the default option.
- To set a specific window, select by schedule and specify the day of the week and UTC time interval.
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.
-
See the description of the CLI command for updating the maintenance window:
yc managed-kafka cluster update --help -
Run this command:
yc managed-kafka 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 information about creating this file, see this guide.
For a complete list of editable Managed Service for Apache Kafka® cluster configuration fields, refer to the Terraform provider guides.
-
To set up the maintenance window (for disabled clusters as well), add the
maintenance_windowsection to the cluster description:resource "yandex_mdb_kafka_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.
-
Time limits
The Terraform provider limits the amount of time for all Managed Service for Apache Kafka® cluster operations to complete to 60 minutes.
Operations exceeding the set timeout are interrupted.
How do I change these limits?
Add the
timeoutsblock to the cluster description, for example:resource "yandex_mdb_kafka_cluster" "<cluster_name>" { ... timeouts { create = "1h30m" # 1 hour 30 minutes update = "2h" # 2 hours delete = "30m" # 30 minutes } } -
-
Save the token to an environment variable:
export IAM_TOKEN="<IAM_token>" -
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
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-kafka/v1/clusters/<cluster_ID>' \ --data '{ "updateMask": "maintenanceWindow", "maintenanceWindow": { "weeklyMaintenanceWindow": { "day": "<day_of_week>", "hour": "<hour>" } } }'Where:
-
updateMask: Comma-separated list of settings to update.Here, we provide only one setting.
-
maintenanceWindow: Maintenance window settings, including for disabled clusters. Possible values:-
anytime: Maintenance can take place at any time. -
weeklyMaintenanceWindow: Maintenance takes place once a week on the specified day and time:day: Day of week inDDDformat:MON,TUE,WED,THU,FRI,SAT, orSUN.hour: Time of day (UTC) inHHformat, from1to24.
-
You can get the cluster ID from the folder’s cluster list.
-
-
Check the server response to make sure your request was successful.
-
Save the token to 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 the repository contents are stored in the
~/cloudapi/directory. -
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_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/kafka/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.kafka.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 disabled clusters. Possible values:-
anytime: Maintenance can take place at any time. -
weekly_maintenance_window: Maintenance takes place once a week on the specified day and time:day: Day of week inDDDformat: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.