Valkey™ version upgrade
You can upgrade a Yandex Managed Service for Valkey™ cluster to any supported version.
Supported versions
All Valkey™ versions, which were supported in Yandex Managed Service for Valkey™, will remain available as long as the vendor continues to support them. Normally, this is for 24 months after a version is released. For more information, see this Valkey™ article
Viewing a list of available Valkey™ versions
- In the management console
, go to the folder dashboard and select Yandex Managed Service for Valkey™. - Select a cluster and click Edit.
- Open the list in the Version field.
Note
To specify the version number in the CLI, Terraform, and the API, add the -valkey suffix to it, e.g., 8.1-valkey.
Before a version upgrade
Make sure this does not affect your applications:
- See Valkey™ changelog
for how upgrades may affect your applications. - Try a version upgrade on a test cluster. You can deploy it from a backup of the main cluster, provided Yandex Managed Service for Valkey™ supports the Valkey™ version in the backup.
- Create a backup of the main cluster directly before the version upgrade.
Upgrading a cluster
Alert
- After updating the DBMS, the cluster cannot be rolled back to the previous version.
- The success of a Valkey™ version upgrade depends on multiple factors, including cluster settings and data stored in databases. We recommend that you begin by upgrading a test cluster that has the same data and settings.
- In the management console
, go to the folder containing the cluster to upgrade. - Select Yandex Managed Service for Valkey™.
- Select the cluster from the list and click Edit.
- In the Version field, select the new version.
- Click Save changes.
As soon as you run the upgrade, the cluster status will change to Updating. Wait for the operation to complete and then check the cluster version.
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.
-
Get a list of your Valkey™ clusters using this command:
yc managed-redis cluster list -
Get information about the cluster you need and check the Valkey™ version in the
config.versionparameter:yc managed-redis cluster get <cluster_name_or_ID> -
Run the Valkey™ upgrade:
yc managed-redis cluster update <cluster_name_or_ID> \ --redis-version <new_version_number>As soon as you run the upgrade, the cluster status will change to Updating. Wait for the operation to complete and then check the cluster version.
-
Open the current Terraform configuration file that defines your infrastructure.
For more information about creating this file, see Creating clusters.
-
Under
config, change theversionparameter to the Valkey™ version you want to upgrade to.resource "yandex_mdb_redis_cluster" "<cluster_name>" { ... config { version = "<new_version_number>" ... } } -
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 the Terraform provider documentation.
Time limits
A Terraform provider sets the timeout for Yandex Managed Service for Valkey™ cluster operations:
- Creating a cluster, including by restoring one from a backup: 15 minutes.
- Editing a cluster: 60 minutes.
- Deleting a cluster: 15 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_redis_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 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-redis/v1/clusters/<cluster_ID>' \ --data '{ "updateMask": "configSpec.version", "configSpec": { "version": "<Valkey™_version>" } }'Where:
-
updateMask: List of parameters to update as a single string, separated by commas.Only one parameter is provided in this case.
-
configSpec.version: New Valkey™ version.
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/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/redis/v1/cluster_service.proto \ -rpc-header "Authorization: Bearer $IAM_TOKEN" \ -d '{ "cluster_id": "<cluster_ID>", "update_mask": { "paths": [ "config_spec.version" ] }, "config_spec": { "version": "<Valkey™_version>" } }' \ mdb.api.cloud.yandex.net:443 \ yandex.cloud.mdb.redis.v1.ClusterService.UpdateWhere:
-
update_mask: List of parameters to update as an array ofpaths[]strings.Only one parameter is provided in this case.
-
config_spec.version: New Valkey™ version.
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.
Examples
Let's assume you need to upgrade your cluster from version 8.1 to version 9.0.
-
To retrieve a list of clusters and find out their IDs and names, run the command below:
yc managed-redis cluster listResult:
+----------------------+---------------+---------------------+--------+---------+ | ID | NAME | CREATED AT | HEALTH | STATUS | +----------------------+---------------+---------------------+--------+---------+ | c9q8p8j2gaih******** | redis406 | 2022-04-23 12:44:17 | ALIVE | RUNNING | +----------------------+---------------+---------------------+--------+---------+ -
To get information about a cluster named
redis406, run the following command:yc managed-redis cluster get redis406Result:
id: c9q8p8j2gaih******** ... config: version: 8.1-valkey ... -
To upgrade a cluster named
redis406to version9.0, run the following command:yc managed-redis cluster update redis406 --redis-version 9.0-valkey`