[Yandex Cloud documentation](../../index.md) > [Yandex Managed Service for Valkey™](../index.md) > [Step-by-step guides](index.md) > Clusters > Updating cluster settings

# Updating Valkey™ cluster settings

After creating a cluster, you can:

* [Change the cluster name and description](#change-name-and-description).

* [Configure the use of FQDNs instead of IP addresses](#configure-fqdn-ip-behavior).

* [Change the data persistence mode](#change-persistence-mode).

* [Change the host class](#change-resource-preset).


* [Change the disk type and expand the storage](#change-disk-size).


* [Set up automatic storage expansion](#disk-size-autoscale).

* [Configure](#change-valkey-config) Valkey™ servers as described in the [Valkey™](https://valkey.io/docs) documentation. For a list of supported settings, see [Valkey™ settings](../concepts/settings-list.md) and the [API reference](../api-ref/Cluster/update.md).

* [Change additional cluster settings](#change-additional-settings).

* [Enable sharding](#enable-sharding) in a non-sharded cluster.

* [Move the cluster](#move-cluster) to another folder.


* [Update security groups](#change-sg-set).


Learn more about other cluster updates:

* [Valkey™ version upgrade](cluster-version-update.md).

* [Migrating hosts to a different availability zone](host-migration.md).

* [Updating Valkey™ user settings](user-update.md).

* [Connecting and reconfiguring Valkey™ modules](modules.md).

## Changing the cluster name and description {#change-name-and-description}

{% list tabs group=instructions %}

- Management console {#console}

  1. In the [management console](https://console.yandex.cloud), select the folder containing your cluster.
  1. Navigate to **Yandex Managed Service for&nbsp;Valkey™**.
  1. Select the cluster.
  1. At the top of the page, click **Edit**.
  1. Under **Basic parameters**, enter a new name and description for the cluster.
  1. Click **Save changes**.

- CLI {#cli}

  If you do not have the Yandex Cloud CLI yet, [install and initialize it](../../cli/quickstart.md#install).

  The folder used by default is the one specified when [creating](../../cli/operations/profile/profile-create.md) the CLI profile. To change the default folder, use the `yc config set folder-id <folder_ID>` command. You can also specify a different folder for any command using `--folder-name` or `--folder-id`. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.

  To change the cluster name and description:

  1. View the description of the CLI command for updating a cluster:

     ```bash
     yc managed-redis cluster update --help
     ```

  1. Run this command, specifying the new cluster name and description:

     ```bash
     yc managed-redis cluster update <cluster_name_or_ID> \
       --new-name <new_cluster_name> \
       --description <new_cluster_description>
     ```

- Terraform {#tf}

    To update the cluster description:

    1. Open the current Terraform configuration file with the infrastructure plan.

        For information on how to create this file, see [Creating a cluster](cluster-create.md).

    1. Update the `description` value in the Yandex Managed Service for Valkey™ cluster description:

        ```hcl
        resource "yandex_mdb_redis_cluster_v2" "<cluster_name>" {
          ...
          description = "<new_cluster_description>"
        }
        ```

    1. Make sure the settings are correct.

        1. In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.
        1. Run this command:
        
           ```bash
           terraform validate
           ```
        
           Terraform will show any errors found in your configuration files.

    1. Confirm updating the resources.

        1. Run this command to view the planned changes:
        
           ```bash
           terraform plan
           ```
        
           If 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.
        
        1. If everything looks correct, apply the changes:
           1. Run this command:
        
              ```bash
              terraform apply
              ```
        
           1. Confirm updating the resources.
           1. Wait for the operation to complete.

    For more information, see [this Terraform provider guide](../../terraform/resources/mdb_redis_cluster_v2.md).

    {% note warning "Timeouts" %}
    
    The Terraform provider sets the following timeouts for Yandex Managed Service for Valkey™ cluster operations:
    
    * Creating a cluster, including by restoring it from a backup: 15 minutes.
    * Editing a cluster: 60 minutes.
    * Deleting a cluster: 15 minutes.
    
    Operations exceeding the timeout are aborted.
    
    {% cut "How do I change these limits?" %}
    
    Add the `timeouts` section to your cluster description, such as the following:
    
    ```hcl
    resource "yandex_mdb_redis_cluster_v2" "<cluster_name>" {
      ...
      timeouts = {
        create = "1h30m" # 1 hour 30 minutes
        update = "2h"    # 2 hours
        delete = "30m"   # 30 minutes
      }
    }
    ```
    
    {% endcut %}
    
    {% endnote %}

- REST API {#api}

    1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

        ```bash
        export IAM_TOKEN="<IAM_token>"
        ```

    1. Call the [Cluster.Update](../api-ref/Cluster/update.md) method, e.g., via the following [cURL](https://curl.se/) request:

        {% note 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.
        
        {% endnote %}

        ```bash
        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": "name,description",
                      "name": "<new_cluster_name>",
                      "description": "<new_cluster_description>"
                    }'
        ```

        Where `updateMask` is the list of parameters to update as a single string, separated by commas.

        You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

    1. Check the [server response](../api-ref/Cluster/update.md#yandex.cloud.operation.Operation) to make sure your request was successful.

- gRPC API {#grpc-api}

    1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

        ```bash
        export IAM_TOKEN="<IAM_token>"
        ```

    1. Clone the [cloudapi](https://github.com/yandex-cloud/cloudapi) repository:
       
       ```bash
       cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
       ```
       
       Below, we assume that the repository contents reside in the `~/cloudapi/` directory.

    1. Call the [ClusterService.Update](../api-ref/grpc/Cluster/update.md) method, e.g., via the following [gRPCurl](https://github.com/fullstorydev/grpcurl) request:

        {% note 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 of `paths[]` strings.
        
        {% cut "Format for listing settings" %}
        
        ```yaml
        "update_mask": {
            "paths": [
                "<setting_1>",
                "<setting_2>",
                ...
                "<setting_N>"
            ]
        }
        ```
        
        {% endcut %}
        
        {% endnote %}

        ```bash
        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": [ "name", "description" ]
                  },
                  "name": "<new_cluster_name>",
                  "description": "<new_cluster_description>" 
                }' \
            mdb.api.cloud.yandex.net:443 \
            yandex.cloud.mdb.redis.v1.ClusterService.Update
        ```

        Where `update_mask` is the list of parameters to update as an array of strings (`paths[]`).

        You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

    1. Check the [server response](../api-ref/grpc/Cluster/update.md#yandex.cloud.operation.Operation) to make sure your request was successful.

{% endlist %}

## Configuring the use of FQDNs instead of IP addresses {#configure-fqdn-ip-behavior}

If the relevant setting is disabled (by default), Valkey™ uses IP addresses as host addresses. If this setting is enabled, it will replace the host’s IP address with its FQDN. You can read more about this setting and where to use it in [Using FQDNs instead of IP addresses](../concepts/network.md#fqdn-ip-setting).

{% note info %}

Some clients do not support this setting and will fail to connect to the cluster hosts. They expect an IP address and will produce errors if you provide an FQDN instead.

{% endnote %}

{% list tabs group=instructions %}

- Management console {#console}

    To enable or disable using FQDNs instead of IP addresses:

    1. In the [management console](https://console.yandex.cloud), select the folder containing your cluster.
    1. Navigate to **Yandex Managed Service for&nbsp;Valkey™**.
    1. Select the cluster.
    1. At the top of the page, click **Edit**.
    1. Under **Basic parameters**, enable or disable **Use FQDN instead of IP addresses** as needed.
    1. Click **Save changes**.

- CLI {#cli}

    If you do not have the Yandex Cloud CLI yet, [install and initialize it](../../cli/quickstart.md#install).

    The folder used by default is the one specified when [creating](../../cli/operations/profile/profile-create.md) the CLI profile. To change the default folder, use the `yc config set folder-id <folder_ID>` command. You can also specify a different folder for any command using `--folder-name` or `--folder-id`. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.

    To enable or disable using FQDNs instead of IP addresses:

    1. View the description of the CLI command for updating a cluster:

        ```bash
        yc managed-redis cluster update --help
        ```

    1. Specify proper values in the cluster update command:

        ```bash
        yc managed-redis cluster update <cluster_name_or_ID> \
          --announce-hostnames <using_FQDNs_instead_of_IP_addresses>
        ```

        Where `--announce-hostnames` is the setting that defines whether to use FQDNs instead of IP addresses: `true` or `false`.

        You can get the cluster name and ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

- Terraform {#tf}

    To enable or disable using FQDNs instead of IP addresses:

    1. Open the current Terraform configuration file with the infrastructure plan.

        For information on how to create this file, see [Creating a cluster](cluster-create.md).

    1. Update the `announce_hostnames` value in the Yandex Managed Service for Valkey™ cluster description:

        ```hcl
        resource "yandex_mdb_redis_cluster_v2" "<cluster_name>" {
          ...
          announce_hostnames = <using_FQDNs_instead_of_IP_addresses>
        }
        ```

        Where `announce_hostnames` is the setting that defines whether to use FQDNs instead of IP addresses: `true` or `false`.

    1. Make sure the settings are correct.

        1. In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.
        1. Run this command:
        
           ```bash
           terraform validate
           ```
        
           Terraform will show any errors found in your configuration files.

    1. Confirm updating the resources.

        1. Run this command to view the planned changes:
        
           ```bash
           terraform plan
           ```
        
           If 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.
        
        1. If everything looks correct, apply the changes:
           1. Run this command:
        
              ```bash
              terraform apply
              ```
        
           1. Confirm updating the resources.
           1. Wait for the operation to complete.

    For more information, see [this Terraform provider guide](../../terraform/resources/mdb_redis_cluster_v2.md).

    {% note warning "Timeouts" %}
    
    The Terraform provider sets the following timeouts for Yandex Managed Service for Valkey™ cluster operations:
    
    * Creating a cluster, including by restoring it from a backup: 15 minutes.
    * Editing a cluster: 60 minutes.
    * Deleting a cluster: 15 minutes.
    
    Operations exceeding the timeout are aborted.
    
    {% cut "How do I change these limits?" %}
    
    Add the `timeouts` section to your cluster description, such as the following:
    
    ```hcl
    resource "yandex_mdb_redis_cluster_v2" "<cluster_name>" {
      ...
      timeouts = {
        create = "1h30m" # 1 hour 30 minutes
        update = "2h"    # 2 hours
        delete = "30m"   # 30 minutes
      }
    }
    ```
    
    {% endcut %}
    
    {% endnote %}

- REST API {#api}

    1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

        ```bash
        export IAM_TOKEN="<IAM_token>"
        ```

    1. Call the [Cluster.Update](../api-ref/Cluster/update.md) method, e.g., via the following [cURL](https://curl.se/) request:

        {% note 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.
        
        {% endnote %}

        ```bash
        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": "announceHostnames",
                      "announceHostnames": <using_FQDNs_instead_of_IP_addresses>
                    }'
        ```

        Where:

        * `updateMask`: Comma-separated string of settings to update.

            Here, we provide only one setting.

        * `announceHostnames`: [Using FQDNs instead of IP addresses](../concepts/network.md#fqdn-ip-setting), `true` or `false`.

        You can request the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

    1. Check the [server response](../api-ref/Cluster/update.md#yandex.cloud.operation.Operation) to make sure your request was successful.

- gRPC API {#grpc-api}

    1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

        ```bash
        export IAM_TOKEN="<IAM_token>"
        ```

    1. Clone the [cloudapi](https://github.com/yandex-cloud/cloudapi) repository:
       
       ```bash
       cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
       ```
       
       Below, we assume that the repository contents reside in the `~/cloudapi/` directory.

    1. Call the [ClusterService.Update](../api-ref/grpc/Cluster/update.md) method, e.g., via the following [gRPCurl](https://github.com/fullstorydev/grpcurl) request:

        {% note 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 of `paths[]` strings.
        
        {% cut "Format for listing settings" %}
        
        ```yaml
        "update_mask": {
            "paths": [
                "<setting_1>",
                "<setting_2>",
                ...
                "<setting_N>"
            ]
        }
        ```
        
        {% endcut %}
        
        {% endnote %}

        ```bash
        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": [ "announce_hostnames" ]
                  },
                  "announce_hostnames": <using_FQDNs_instead_of_IP_addresses>
                }' \
            mdb.api.cloud.yandex.net:443 \
            yandex.cloud.mdb.redis.v1.ClusterService.Update
        ```

        Where:

        * `update_mask`: List of settings you want to update as an array of strings (`paths[]`).

            Here, we provide only one setting.

        * `announce_hostnames`: [Using FQDNs instead of IP addresses](../concepts/network.md#fqdn-ip-setting), `true` or `false`.

        You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

    1. Check the [server response](../api-ref/grpc/Cluster/update.md#yandex.cloud.operation.Operation) to make sure your request was successful.

{% endlist %}

## Changing the data persistence mode {#change-persistence-mode}

For more information about data persistence and its settings, see [Persistence](../concepts/replication.md#persistence).

{% list tabs group=instructions %}

- Management console {#console}

    To change the persistence mode:

    1. In the [management console](https://console.yandex.cloud), select the folder containing your cluster.
    1. Navigate to **Yandex Managed Service for&nbsp;Valkey™**.
    1. Select the cluster.
    1. At the top of the page, click **Edit**.
    1. Under **Basic parameters**, select the persistence mode.
    1. Click **Save changes**.

- CLI {#cli}

    If you do not have the Yandex Cloud CLI yet, [install and initialize it](../../cli/quickstart.md#install).

    The folder used by default is the one specified when [creating](../../cli/operations/profile/profile-create.md) the CLI profile. To change the default folder, use the `yc config set folder-id <folder_ID>` command. You can also specify a different folder for any command using `--folder-name` or `--folder-id`. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.

    To change the persistence mode:

    1. View the description of the CLI command for updating a cluster:

        ```bash
        yc managed-redis cluster update --help
        ```

    1.  Specify proper values in the cluster update command:

        ```bash
        yc managed-redis cluster update <cluster_name_or_ID> \
          --persistence-mode <persistence_mode>
        ```

        The possible values are:
        
        * `ON`: Enable persistence.
        * `OFF`: Disable persistence.
        * `ON_REPLICAS`: Enable persistence on replicas only.

        You can get the cluster name and ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

- Terraform {#tf}

    To change the persistence mode:

    1. Open the current Terraform configuration file with the infrastructure plan.

        For information on how to create this file, see [Creating a cluster](cluster-create.md).

    1. Update the `persistence_mode` value in the Yandex Managed Service for Valkey™ cluster description:

        ```hcl
        resource "yandex_mdb_redis_cluster_v2" "<cluster_name>" {
          ...
          persistence_mode = "<persistence_mode>"
        }
        ```

        The possible values are:
        
        * `ON`: Enable persistence.
        * `OFF`: Disable persistence.
        * `ON_REPLICAS`: Enable persistence on replicas only.

    1. Make sure the settings are correct.

        1. In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.
        1. Run this command:
        
           ```bash
           terraform validate
           ```
        
           Terraform will show any errors found in your configuration files.

    1. Confirm updating the resources.

        1. Run this command to view the planned changes:
        
           ```bash
           terraform plan
           ```
        
           If 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.
        
        1. If everything looks correct, apply the changes:
           1. Run this command:
        
              ```bash
              terraform apply
              ```
        
           1. Confirm updating the resources.
           1. Wait for the operation to complete.

    For more information, see [this Terraform provider guide](../../terraform/resources/mdb_redis_cluster_v2.md).

    {% note warning "Timeouts" %}
    
    The Terraform provider sets the following timeouts for Yandex Managed Service for Valkey™ cluster operations:
    
    * Creating a cluster, including by restoring it from a backup: 15 minutes.
    * Editing a cluster: 60 minutes.
    * Deleting a cluster: 15 minutes.
    
    Operations exceeding the timeout are aborted.
    
    {% cut "How do I change these limits?" %}
    
    Add the `timeouts` section to your cluster description, such as the following:
    
    ```hcl
    resource "yandex_mdb_redis_cluster_v2" "<cluster_name>" {
      ...
      timeouts = {
        create = "1h30m" # 1 hour 30 minutes
        update = "2h"    # 2 hours
        delete = "30m"   # 30 minutes
      }
    }
    ```
    
    {% endcut %}
    
    {% endnote %}

- REST API {#api}

    1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

        ```bash
        export IAM_TOKEN="<IAM_token>"
        ```

    1. Call the [Cluster.Update](../api-ref/Cluster/update.md) method, e.g., via the following [cURL](https://curl.se/) request:

        {% note 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.
        
        {% endnote %}

        ```bash
        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": "persistenceMode",
                      "persistenceMode": "<persistence_mode>"
                    }'
        ```

        Where:

        * `updateMask`: Comma-separated string of settings to update.

            Here, we provide only one setting.

        * `persistenceMode`: Persistence mode.

            The possible values are:
            
            * `ON`: Enable persistence.
            * `OFF`: Disable persistence.
            * `ON_REPLICAS`: Enable persistence on replicas only.

        You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

    1. Check the [server response](../api-ref/Cluster/update.md#yandex.cloud.operation.Operation) to make sure your request was successful.

- gRPC API {#grpc-api}

    1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

        ```bash
        export IAM_TOKEN="<IAM_token>"
        ```

    1. Clone the [cloudapi](https://github.com/yandex-cloud/cloudapi) repository:
       
       ```bash
       cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
       ```
       
       Below, we assume that the repository contents reside in the `~/cloudapi/` directory.

    1. Call the [ClusterService.Update](../api-ref/grpc/Cluster/update.md) method, e.g., via the following [gRPCurl](https://github.com/fullstorydev/grpcurl) request:

        {% note 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 of `paths[]` strings.
        
        {% cut "Format for listing settings" %}
        
        ```yaml
        "update_mask": {
            "paths": [
                "<setting_1>",
                "<setting_2>",
                ...
                "<setting_N>"
            ]
        }
        ```
        
        {% endcut %}
        
        {% endnote %}

        ```bash
        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": [ "persistence_mode" ]
                  },
                  "persistence_mode": "<persistence_mode>"
                }' \
            mdb.api.cloud.yandex.net:443 \
            yandex.cloud.mdb.redis.v1.ClusterService.Update
        ```

        Where:

        * `update_mask`: List of settings you want to update as an array of strings (`paths[]`).

            Here, we provide only one setting.

        * `persistence_mode`: Persistence mode.

           The possible values are:
           
           * `ON`: Enable persistence.
           * `OFF`: Disable persistence.
           * `ON_REPLICAS`: Enable persistence on replicas only.

        You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

    1. Check the [server response](../api-ref/grpc/Cluster/update.md#yandex.cloud.operation.Operation) to make sure your request was successful.

{% endlist %}

## Changing the host class {#change-resource-preset}


When changing the host class:

* A single-host cluster will be unavailable for a few minutes and all database connections will be dropped.
* In a non-sharded multiple-host cluster:
   * The master will change. The hosts will undergo a rolling update, with each host unavailable for a few minutes while it is stopped and updated.
   * Using a [special FQDN](connect/fqdn.md#special-fqdns) does not guarantee a stable database connection: user sessions may be terminated.
* In a sharded cluster:
   * Each shard with more than one host will switch its master.
   * Each shard will run a rolling update, stopping and updating hosts sequentially. The shard's master host will be unavailable for a few minutes while it updates.
   * The master host name may not resolve. If public access to the host is enabled, you can only connect using the host IP address.
* A cluster with local SSD storage may be unavailable for an extended period in case data migration to another physical server is required.

We recommend changing the host class only when the cluster is idle.

{% list tabs group=instructions %}

- Management console {#console}

  1. In the [management console](https://console.yandex.cloud), select the folder containing your cluster.
  1. Navigate to **Yandex Managed Service for&nbsp;Valkey™**.
  1. Select the cluster.
  1. At the top of the page, click **Edit**.
  1. Under **Host class**:
     
	 * Select a platform in the **Platform** field.
     * Select the **Type** of the virtual machine where you want to deploy the hosts:
        * `high-memory`: Increased RAM per 1 vCPU.
        * `burstable`: Partial guaranteed share of vCPU. VMs with a guaranteed share below 100% provide the specified performance level with temporary boosts up to 100%. Clusters with such hosts are good for tasks that do not require guaranteed permanent performance, such as testing.
     * Change the host configuration.
	 
  1. Click **Save changes**.

- CLI {#cli}

  If you do not have the Yandex Cloud CLI yet, [install and initialize it](../../cli/quickstart.md#install).

  The folder used by default is the one specified when [creating](../../cli/operations/profile/profile-create.md) the CLI profile. To change the default folder, use the `yc config set folder-id <folder_ID>` command. You can also specify a different folder for any command using `--folder-name` or `--folder-id`. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.

  To change the cluster’s [host class](../concepts/instance-types.md):

  1. View the description of the CLI command for updating a cluster:

     ```bash
     yc managed-redis cluster update --help
     ```

  1. Get the list of available host classes (the `ZONE IDS` column lists the availability zones you can select each class in):

     
     ```bash
     yc managed-redis resource-preset list
     ```

     Result:

     ```text
     +-------------+--------------------------------+----------+
     |     ID      |            ZONE IDS            |  MEMORY  |
     +-------------+--------------------------------+----------+
     | b1.nano     | ru-central1-a, ru-central1-b,  | 2.0 GB   |
     |             | ru-central1-d                  |          |
     | b1.small    | ru-central1-a, ru-central1-b,  | 4.0 GB   |
     |             | ru-central1-d                  |          |
     | hm1.nano    | ru-central1-a, ru-central1-b,  | 8.0 GB   |
     |             | ru-central1-d                  |          |
     | hm1.micro   | ru-central1-a, ru-central1-b,  | 12.0 GB  |
     | ...                                                     |
     +-----------+----------------------------------+----------+
     ```


  1. Specify the relevant class in the cluster update command:

     ```bash
     yc managed-redis cluster update <cluster_name_or_ID> \
       --resource-preset <host_class_ID>
     ```

     Yandex Managed Service for Valkey™ will start updating the host class for your cluster.

- Terraform {#tf}

    1. Open the current Terraform configuration file with the infrastructure plan.

        For information on how to create this file, see [Creating a cluster](cluster-create.md).

    1. In the Yandex Managed Service for Valkey™ cluster description, change the `resource_preset_id` parameter value under `resources`:

        ```hcl
        resource "yandex_mdb_redis_cluster_v2" "<cluster_name>" {
          ...
          resources = {
            resource_preset_id = "<host_class>"
            ...
            }
        }
        ```

    1. Make sure the settings are correct.

        1. In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.
        1. Run this command:
        
           ```bash
           terraform validate
           ```
        
           Terraform will show any errors found in your configuration files.

    1. Confirm updating the resources.

        1. Run this command to view the planned changes:
        
           ```bash
           terraform plan
           ```
        
           If 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.
        
        1. If everything looks correct, apply the changes:
           1. Run this command:
        
              ```bash
              terraform apply
              ```
        
           1. Confirm updating the resources.
           1. Wait for the operation to complete.

    For more information, see [this Terraform provider guide](../../terraform/resources/mdb_redis_cluster_v2.md).

    {% note warning "Timeouts" %}
    
    The Terraform provider sets the following timeouts for Yandex Managed Service for Valkey™ cluster operations:
    
    * Creating a cluster, including by restoring it from a backup: 15 minutes.
    * Editing a cluster: 60 minutes.
    * Deleting a cluster: 15 minutes.
    
    Operations exceeding the timeout are aborted.
    
    {% cut "How do I change these limits?" %}
    
    Add the `timeouts` section to your cluster description, such as the following:
    
    ```hcl
    resource "yandex_mdb_redis_cluster_v2" "<cluster_name>" {
      ...
      timeouts = {
        create = "1h30m" # 1 hour 30 minutes
        update = "2h"    # 2 hours
        delete = "30m"   # 30 minutes
      }
    }
    ```
    
    {% endcut %}
    
    {% endnote %}

- REST API {#api}

    1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

        ```bash
        export IAM_TOKEN="<IAM_token>"
        ```

    1. Call the [Cluster.Update](../api-ref/Cluster/update.md) method, e.g., via the following [cURL](https://curl.se/) request:

        {% note 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.
        
        {% endnote %}

        ```bash
        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.resources.resourcePresetId",
                      "configSpec": {
                        "resources": {
                          "resourcePresetId": "<host_class>"
                        }
                      }
                    }'
        ```

        Where:

        * `updateMask`: Comma-separated string of settings to update.

            Here, we provide only one setting.

        * `configSpec.resources.resourcePresetId`: New [host class](../concepts/instance-types.md). To get the list of supported values, call the [ResourcePreset.List](../api-ref/ResourcePreset/list.md) method.

        You can request the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

    1. Check the [server response](../api-ref/Cluster/update.md#yandex.cloud.operation.Operation) to make sure your request was successful.

- gRPC API {#grpc-api}

    1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

        ```bash
        export IAM_TOKEN="<IAM_token>"
        ```

    1. Clone the [cloudapi](https://github.com/yandex-cloud/cloudapi) repository:
       
       ```bash
       cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
       ```
       
       Below, we assume that the repository contents reside in the `~/cloudapi/` directory.

    1. Call the [ClusterService.Update](../api-ref/grpc/Cluster/update.md) method, e.g., via the following [gRPCurl](https://github.com/fullstorydev/grpcurl) request:

        {% note 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 of `paths[]` strings.
        
        {% cut "Format for listing settings" %}
        
        ```yaml
        "update_mask": {
            "paths": [
                "<setting_1>",
                "<setting_2>",
                ...
                "<setting_N>"
            ]
        }
        ```
        
        {% endcut %}
        
        {% endnote %}

        ```bash
        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.resources.resource_preset_id" ]
                  },
                  "config_spec": {
                    "resources": {
                      "resource_preset_id": "<host_class>"
                    }
                  }
                }' \
            mdb.api.cloud.yandex.net:443 \
            yandex.cloud.mdb.redis.v1.ClusterService.Update
        ```

        Where:

        * `update_mask`: List of settings you want to update as an array of strings (`paths[]`).

            Here, we provide only one setting.

        * `config_spec.resources.resource_preset_id`: New [host class](../concepts/instance-types.md). To get the list of supported values, call the [ResourcePreset.List](../api-ref/ResourcePreset/list.md) method.

        You can request the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

    1. Check the [server response](../api-ref/grpc/Cluster/update.md#yandex.cloud.operation.Operation) to make sure your request was successful.

{% endlist %}

## Changing the disk type and increasing the storage size {#change-disk-size}

Make sure the cloud has enough quota to increase the storage size. Open the cloud's [Quotas](https://console.yandex.cloud/cloud?section=quotas) page and check the **HDD storage capacity** and **SSD storage capacity** lines under **Managed Databases** to make sure there is available quota for storage space.

{% list tabs group=instructions %}

- Management console {#console}

  To change the disk type and increase the storage size for a cluster:

  1. In the [management console](https://console.yandex.cloud), select the folder containing your cluster.
  1. Navigate to **Yandex Managed Service for&nbsp;Valkey™**.
  1. Select the cluster.
  1. At the top of the page, click **Edit**.

  
  1. Under **Storage size**:

      * Select the [disk type](../concepts/storage.md).
      * Specify the disk size.


  1. Click **Save changes**.

- CLI {#cli}

  If you do not have the Yandex Cloud CLI yet, [install and initialize it](../../cli/quickstart.md#install).

  The folder used by default is the one specified when [creating](../../cli/operations/profile/profile-create.md) the CLI profile. To change the default folder, use the `yc config set folder-id <folder_ID>` command. You can also specify a different folder for any command using `--folder-name` or `--folder-id`. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.

  To increase the storage size of your Valkey™ hosts:

  1. View the description of the CLI command for updating a cluster:

     ```bash
     yc managed-redis cluster update --help
     ```

  1. Specify the required storage size in the cluster update command. The new size must be at least as big as the current `disk_size` value in the cluster properties.

     ```bash
     yc managed-redis cluster update <cluster_name_or_ID> \
       --disk-size <storage_size_in_GB>
     ```

     If all the criteria are met, Yandex Managed Service for Valkey™ starts increasing the size of the Valkey™ host disks.

- Terraform {#tf}

  To increase your cluster storage size:

    1. Open the current Terraform configuration file with the infrastructure plan.

        For information on how to create this file, see [Creating a cluster](cluster-create.md).

    1. In the Yandex Managed Service for Valkey™ cluster description, change the `disk_size` parameter value under `resources`:

        ```hcl
        resource "yandex_mdb_redis_cluster_v2" "<cluster_name>" {
          ...
          resources = {
            disk_size = <storage_size_in_GB>
            ...
            }
        }
        ```

    1. Make sure the settings are correct.

        1. In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.
        1. Run this command:
        
           ```bash
           terraform validate
           ```
        
           Terraform will show any errors found in your configuration files.

    1. Confirm updating the resources.

        1. Run this command to view the planned changes:
        
           ```bash
           terraform plan
           ```
        
           If 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.
        
        1. If everything looks correct, apply the changes:
           1. Run this command:
        
              ```bash
              terraform apply
              ```
        
           1. Confirm updating the resources.
           1. Wait for the operation to complete.

    For more information, see [this Terraform provider guide](../../terraform/resources/mdb_redis_cluster_v2.md).

    {% note warning "Timeouts" %}
    
    The Terraform provider sets the following timeouts for Yandex Managed Service for Valkey™ cluster operations:
    
    * Creating a cluster, including by restoring it from a backup: 15 minutes.
    * Editing a cluster: 60 minutes.
    * Deleting a cluster: 15 minutes.
    
    Operations exceeding the timeout are aborted.
    
    {% cut "How do I change these limits?" %}
    
    Add the `timeouts` section to your cluster description, such as the following:
    
    ```hcl
    resource "yandex_mdb_redis_cluster_v2" "<cluster_name>" {
      ...
      timeouts = {
        create = "1h30m" # 1 hour 30 minutes
        update = "2h"    # 2 hours
        delete = "30m"   # 30 minutes
      }
    }
    ```
    
    {% endcut %}
    
    {% endnote %}

- REST API {#api}

    1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

        ```bash
        export IAM_TOKEN="<IAM_token>"
        ```

    1. Call the [Cluster.Update](../api-ref/Cluster/update.md) method, e.g., via the following [cURL](https://curl.se/) request:

        {% note 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.
        
        {% endnote %}

        
        ```bash
        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.resources.diskTypeId,configSpec.resources.diskSize",
                      "configSpec": {
                        "resources": {
                          "diskTypeId": "<disk_type>",
                          "diskSize": "<storage_size_in_bytes>"
                        }
                      }
                    }'
        ```


        Where:

        * `updateMask`: Comma-separated string of settings to update.

        
        * `configSpec.resources`: Storage settings:

            * `diskTypeId`: [Disk type](../concepts/storage.md).
            * `diskSize`: New storage size in bytes.


        You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

    1. Check the [server response](../api-ref/Cluster/update.md#yandex.cloud.operation.Operation) to make sure your request was successful.

- gRPC API {#grpc-api}

    1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

        ```bash
        export IAM_TOKEN="<IAM_token>"
        ```

    1. Clone the [cloudapi](https://github.com/yandex-cloud/cloudapi) repository:
       
       ```bash
       cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
       ```
       
       Below, we assume that the repository contents reside in the `~/cloudapi/` directory.

    1. Call the [ClusterService.Update](../api-ref/grpc/Cluster/update.md) method, e.g., via the following [gRPCurl](https://github.com/fullstorydev/grpcurl) request:

        {% note 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 of `paths[]` strings.
        
        {% cut "Format for listing settings" %}
        
        ```yaml
        "update_mask": {
            "paths": [
                "<setting_1>",
                "<setting_2>",
                ...
                "<setting_N>"
            ]
        }
        ```
        
        {% endcut %}
        
        {% endnote %}

        
        ```bash
        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.resources.disk_type_id",
                      "config_spec.resources.disk_size"
                    ]
                  },
                  "config_spec": {
                    "resources": {
                      "disk_type_id": "<disk_type>",
                      "disk_size": "<storage_size_in_bytes>"
                    }
                  }
                }' \
            mdb.api.cloud.yandex.net:443 \
            yandex.cloud.mdb.redis.v1.ClusterService.Update
        ```


        Where:

        * `update_mask`: List of settings you want to update as an array of strings (`paths[]`).

        
        * `config_spec.resources`: Storage settings:

            * `disk_type_id`: [Disk type](../concepts/storage.md).
            * `disk_size`: New storage size in bytes.


        You can request the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

    1. Check the [server response](../api-ref/grpc/Cluster/update.md#yandex.cloud.operation.Operation) to make sure your request was successful.

{% endlist %}

## Set up automatic storage expansion {#disk-size-autoscale}

For more information about storage and autoscaling, see [Storage in Yandex Managed Service for Valkey™](../concepts/storage.md).

Make sure the cloud has enough quota to increase the storage size. Open the cloud's [Quotas](https://console.yandex.cloud/cloud?section=quotas) page and check the **HDD storage capacity** and **SSD storage capacity** lines under **Managed Databases** to make sure there is available quota for storage space.

{% list tabs group=instructions %}

- Management console {#console}

  1. Navigate to **Yandex Managed Service for&nbsp;Valkey™**.

  1. In the cluster row, click ![image](../../_assets/console-icons/ellipsis.svg) and select **Edit**.

  1. Under **Resources**, configure the automatic increase of the disk size:

        * In the **Increase size** field, set the conditions for the actions below:
        
            * Storage expansion during the [next maintenance window](../concepts/maintenance.md#maintenance-window) if and when the specified storage space utilization percentage is exceeded. If you set this condition, configure the maintenance schedule.
        
            * Storage expansion immediately if and when the specified storage space utilization percentage is exceeded.
        
                {% note warning %}
        
                If you set both conditions, make sure the immediate expansion threshold is higher than the scheduled one.
        
                {% endnote %}
        
        * In the **Maximum storage size** field, specify the maximum storage size that can be set during autoscaling.
        
        
        {% note warning %}
        
        * You cannot decrease the storage size after automatic expansion.
        * During storage resizing, cluster hosts will be stopped and updated one at a time.
        
        {% endnote %}

  1. Save your changes.

- CLI {#cli}

  If you do not have the Yandex Cloud CLI yet, [install and initialize it](../../cli/quickstart.md#install).

  The folder used by default is the one specified when [creating](../../cli/operations/profile/profile-create.md) the CLI profile. To change the default folder, use the `yc config set folder-id <folder_ID>` command. You can also specify a different folder for any command using `--folder-name` or `--folder-id`. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.

  To set up automatic storage expansion:

  1. View the description of the CLI command for updating a cluster:

     ```bash
     yc managed-redis cluster update --help
     ```

  1. Run this command, specifying the maximum storage size and the conditions for autoscaling:

      ```bash
      yc managed-redis cluster update <cluster_ID_or_name> \
          --disk-size-autoscaling planned-usage-threshold=<scheduled_expansion_percentage>,`
                                  `emergency-usage-threshold=<immediate_expansion_percentage>,`
                                  `disk-size-limit=<maximum_storage_size_in_GB> \
      ```

      Where:

      * `planned-usage-threshold`: Storage usage percentage to trigger a storage expansion during the next [maintenance window](../concepts/maintenance.md#maintenance-window).
      
        Use a value between `0` and `100`%. The default value is `0`, i.e., automatic expansion is disabled.
      
        If you set this condition, [configure](update.md#change-additional-settings) the maintenance schedule.
      
      * `emergency-usage-threshold`: Storage usage percentage to trigger an immediate storage expansion.
      
        Use a value between `0` and `100`%. The default value is `0`, i.e., automatic expansion is disabled.
      
        {% note warning %}
      
        If you specify both thresholds, `emergency-usage-threshold` must not be less than `planned-usage-threshold`.
      
        {% endnote %}
      
      * `disk-size-limit`: Maximum storage size after expansion, in GB.
      
      
      {% note warning %}
      
      * You cannot decrease the storage size after automatic expansion.
      * During storage resizing, cluster hosts will be stopped and updated one at a time.
      
      {% endnote %}

- Terraform {#tf}

  To set up automatic storage expansion:

  1. Open the current Terraform configuration file with the infrastructure plan.

      For information on how to create this file, see [Creating a cluster](cluster-create.md).

  1. Add the following section to the cluster description:

      ```hcl
      disk_size_autoscaling = {
        planned_usage_threshold   = "<scheduled_expansion_percentage>"
        emergency_usage_threshold = "<immediate_expansion_percentage>"
        disk_size_limit           = "<maximum_storage_size_in_GiB>"
      }
      ```

      Where:

      * `planned_usage_threshold`: Storage usage percentage to trigger a storage expansion during the next [maintenance window](../concepts/maintenance.md#maintenance-window).
      
          Use a value between `0` and `100`%. The default value is `0`, i.e., automatic expansion is disabled.
      
          If you set this condition, configure the maintenance schedule in the `maintenance_window` section.
      
      * `emergency_usage_threshold`: Storage usage percentage to trigger an immediate storage expansion.
      
          Use a value between `0` and `100`%. The default value is `0`, i.e., automatic expansion is disabled.
      
          {% note warning %}
      
          If you specify both thresholds, `emergency_usage_threshold` must not be less than `planned_usage_threshold`.
      
          {% endnote %}
      
      * `disk_size_limit`: Maximum storage size after the increase, in gibibytes.
      
      
      {% note warning %}
      
      * You cannot decrease the storage size after automatic expansion.
      * During storage resizing, cluster hosts will be stopped and updated one at a time.
      
      {% endnote %}

  1. Make sure the settings are correct.

      1. In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.
      1. Run this command:
      
         ```bash
         terraform validate
         ```
      
         Terraform will show any errors found in your configuration files.

  1. Confirm updating the resources.

      1. Run this command to view the planned changes:
      
         ```bash
         terraform plan
         ```
      
         If 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.
      
      1. If everything looks correct, apply the changes:
         1. Run this command:
      
            ```bash
            terraform apply
            ```
      
         1. Confirm updating the resources.
         1. Wait for the operation to complete.

  For more information, see [this Terraform provider guide](../../terraform/resources/mdb_redis_cluster_v2.md).

  {% note warning "Timeouts" %}
  
  The Terraform provider sets the following timeouts for Yandex Managed Service for Valkey™ cluster operations:
  
  * Creating a cluster, including by restoring it from a backup: 15 minutes.
  * Editing a cluster: 60 minutes.
  * Deleting a cluster: 15 minutes.
  
  Operations exceeding the timeout are aborted.
  
  {% cut "How do I change these limits?" %}
  
  Add the `timeouts` section to your cluster description, such as the following:
  
  ```hcl
  resource "yandex_mdb_redis_cluster_v2" "<cluster_name>" {
    ...
    timeouts = {
      create = "1h30m" # 1 hour 30 minutes
      update = "2h"    # 2 hours
      delete = "30m"   # 30 minutes
    }
  }
  ```
  
  {% endcut %}
  
  {% endnote %}

- REST API {#api}

    1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

        ```bash
        export IAM_TOKEN="<IAM_token>"
        ```

    1. Call the [Cluster.Update](../api-ref/Cluster/update.md) method, e.g., via the following [cURL](https://curl.se/) request:

        {% note 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.
        
        {% endnote %}

        ```bash
        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.diskSizeAutoscaling",
                      "configSpec": {
                        "diskSizeAutoscaling": {
                          "plannedUsageThreshold": "<scheduled_expansion_percentage>",
                          "emergencyUsageThreshold": "<immediate_expansion_percentage>",
                          "diskSizeLimit": "<maximum_storage_size_in_bytes>"
                        }
                      }
                    }'
        ```

        Where:

          * `updateMask`: Comma-separated string of settings to update.

        * `diskSizeAutoscaling`: Automatic storage expansion settings:
        
          * `plannedUsageThreshold`: Storage usage percentage to trigger a storage expansion during the next [maintenance window](../concepts/maintenance.md#maintenance-window).
        
            Use a value between `0` and `100`%. The default value is `0`, i.e., automatic expansion is disabled.
        
            If you set this condition, configure the `maintenanceWindow`.
        
          * `emergencyUsageThreshold`: Storage usage percentage to trigger an immediate storage expansion.
        
            Use a value between `0` and `100`%. The default value is `0`, i.e., automatic expansion is disabled.
        
            {% note warning %}
        
            If you specify both thresholds, `emergencyUsageThreshold` must not be less than `plannedUsageThreshold`.
        
            {% endnote %}
        
          * `diskSizeLimit`: Maximum storage size after expansion, in bytes.
        
          
          {% note warning %}
          
          * You cannot decrease the storage size after automatic expansion.
          * During storage resizing, cluster hosts will be stopped and updated one at a time.
          
          {% endnote %}

        You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

    1. Check the [server response](../api-ref/Cluster/update.md#yandex.cloud.operation.Operation) to make sure your request was successful.

- gRPC API {#grpc-api}

    1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

        ```bash
        export IAM_TOKEN="<IAM_token>"
        ```

    1. Clone the [cloudapi](https://github.com/yandex-cloud/cloudapi) repository:
       
       ```bash
       cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
       ```
       
       Below, we assume that the repository contents reside in the `~/cloudapi/` directory.

    1. Call the [ClusterService.Update](../api-ref/grpc/Cluster/update.md) method, e.g., via the following [gRPCurl](https://github.com/fullstorydev/grpcurl) request:

        {% note 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 of `paths[]` strings.
        
        {% cut "Format for listing settings" %}
        
        ```yaml
        "update_mask": {
            "paths": [
                "<setting_1>",
                "<setting_2>",
                ...
                "<setting_N>"
            ]
        }
        ```
        
        {% endcut %}
        
        {% endnote %}

        ```bash
        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.disk_size_autoscaling" ]
                  },
                  "config_spec": {
                    "disk_size_autoscaling": {
                      "planned_usage_threshold": "<scheduled_expansion_percentage>",
                      "emergency_usage_threshold": "<immediate_expansion_percentage>",
                      "disk_size_limit": "<maximum_storage_size_in_bytes>"
                    }
                  }
                }' \
            mdb.api.cloud.yandex.net:443 \
            yandex.cloud.mdb.redis.v1.ClusterService.Update
        ```

        Where:

          * `update_mask`: List of settings to update as an array of strings (`paths[]`).

          * `disk_size_autoscaling`: Automatic storage expansion settings:
          
            * `planned_usage_threshold`: Storage usage percentage to trigger a storage expansion during the next [maintenance window](../concepts/maintenance.md#maintenance-window).
          
              Use a value between `0` and `100`%. The default value is `0`, i.e., automatic expansion is disabled.
          
              If you set this condition, configure the `maintenance_window`.
          
            * `emergency_usage_threshold`: Storage usage percentage to trigger an immediate storage expansion.
          
              Use a value between `0` and `100`%. The default value is `0`, i.e., automatic expansion is disabled.
          
              {% note warning %}
          
              If you specify both thresholds, `emergency_usage_threshold` must not be less than `planned_usage_threshold`.
          
              {% endnote %}
          
            * `disk_size_limit`: Maximum storage size after expansion, in bytes.
            
            
            {% note warning %}
            
            * You cannot decrease the storage size after automatic expansion.
            * During storage resizing, cluster hosts will be stopped and updated one at a time.
            
            {% endnote %}

        You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

    1. Check the [server response](../api-ref/grpc/Cluster/update.md#yandex.cloud.operation.Operation) to make sure your request was successful.

{% endlist %}

## Changing Valkey™ settings {#change-valkey-config}

You can change the DBMS settings for your cluster hosts. You can find all the supported settings in [Valkey™ settings](../concepts/settings-list.md) and in the [API reference](../api-ref/Cluster/update.md).

{% list tabs group=instructions %}

- Management console {#console}

  To change the [DBMS settings](../concepts/settings-list.md) for a cluster:

  1. In the [management console](https://console.yandex.cloud), select the folder containing your cluster.
  1. Navigate to **Yandex Managed Service for&nbsp;Valkey™**.
  1. Select the cluster.
  1. At the top of the page, click **Edit**.
  1. Under **DBMS settings**, click **Settings**.
  1. Configure the available settings according to the [Valkey™ documentation](https://valkey.io/documentation).
  1. Click **Save**.

- Terraform {#tf}

    To change the [DBMS settings](../concepts/settings-list.md) for a cluster:

    1. Open the current Terraform configuration file with the infrastructure plan.

        For information on how to create this file, see [Creating a cluster](cluster-create.md).

    1. Update the settings in the `config` section of your Yandex Managed Service for Valkey™ cluster description:

        ```hcl
        resource "yandex_mdb_redis_cluster_v2" "<cluster_name>" {
          ...
          config = {
            password         = "<password>"
            timeout          = <time>
            maxmemory_policy = "<policy>"
            ...
          }
        }
        ```

        Where:

        * `timeout`: Time, in seconds, before disconnecting inactive clients.
        * `maxmemory_policy`: Memory management policy when low on memory.

        The password must be from 8 to 128 characters long and match the `[a-zA-Z0-9@=+?*.,!&#$^<>_-]*` regular expression.

    1. Make sure the settings are correct.

        1. In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.
        1. Run this command:
        
           ```bash
           terraform validate
           ```
        
           Terraform will show any errors found in your configuration files.

    1. Confirm updating the resources.

        1. Run this command to view the planned changes:
        
           ```bash
           terraform plan
           ```
        
           If 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.
        
        1. If everything looks correct, apply the changes:
           1. Run this command:
        
              ```bash
              terraform apply
              ```
        
           1. Confirm updating the resources.
           1. Wait for the operation to complete.

    For more information, see [this Terraform provider guide](../../terraform/resources/mdb_redis_cluster_v2.md).

    {% note warning "Timeouts" %}
    
    The Terraform provider sets the following timeouts for Yandex Managed Service for Valkey™ cluster operations:
    
    * Creating a cluster, including by restoring it from a backup: 15 minutes.
    * Editing a cluster: 60 minutes.
    * Deleting a cluster: 15 minutes.
    
    Operations exceeding the timeout are aborted.
    
    {% cut "How do I change these limits?" %}
    
    Add the `timeouts` section to your cluster description, such as the following:
    
    ```hcl
    resource "yandex_mdb_redis_cluster_v2" "<cluster_name>" {
      ...
      timeouts = {
        create = "1h30m" # 1 hour 30 minutes
        update = "2h"    # 2 hours
        delete = "30m"   # 30 minutes
      }
    }
    ```
    
    {% endcut %}
    
    {% endnote %}

- REST API {#api}

    1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

        ```bash
        export IAM_TOKEN="<IAM_token>"
        ```

    1. Call the [Cluster.Update](../api-ref/Cluster/update.md) method, e.g., via the following [cURL](https://curl.se/) request:

        {% note 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.
        
        {% endnote %}

        ```bash
        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.redisConfig_<Valkey™_version>.<setting_1>,configSpec.redisConfig_<Valkey™_version>.<setting_2>,...,configSpec.redisConfig_<Valkey™_version>.<setting_N>",
                      "configSpec": {
                        "redisConfig_<Valkey™_version>": {
                          "<setting_1>": "<value_1>",
                          "<setting_2>": "<value_2>",
                          ...
                          "<setting_N>": "<value_N>"
                        }
                      }
                    }'
        ```

        Where:

        * `updateMask`: Comma-separated string of settings to update.

        * `configSpec.redisConfig_<Valkey™_version>`: Valkey™ settings. Enter each setting on a new line, separated by commas.

            See the [method description](../api-ref/Cluster/update.md#yandex.cloud.mdb.redis.v1.UpdateClusterRequest) for the list of Valkey™ versions supporting this option. See [Valkey™ settings](../concepts/settings-list.md) for descriptions and possible values of the settings.

        You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

    1. Check the [server response](../api-ref/Cluster/update.md#yandex.cloud.operation.Operation) to make sure your request was successful.

- gRPC API {#grpc-api}

    1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

        ```bash
        export IAM_TOKEN="<IAM_token>"
        ```

    1. Clone the [cloudapi](https://github.com/yandex-cloud/cloudapi) repository:
       
       ```bash
       cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
       ```
       
       Below, we assume that the repository contents reside in the `~/cloudapi/` directory.

    1. Call the [ClusterService.Update](../api-ref/grpc/Cluster/update.md) method, e.g., via the following [gRPCurl](https://github.com/fullstorydev/grpcurl) request:

        {% note 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 of `paths[]` strings.
        
        {% cut "Format for listing settings" %}
        
        ```yaml
        "update_mask": {
            "paths": [
                "<setting_1>",
                "<setting_2>",
                ...
                "<setting_N>"
            ]
        }
        ```
        
        {% endcut %}
        
        {% endnote %}

        ```bash
        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.redis_config_<Valkey™_version>.<setting_1>",
                      "config_spec.redis_config_<Valkey™_version>.<setting_2>",
                      ...
                      "config_spec.redis_config_<Valkey™_version>.<setting_N>"
                    ]
                  },
                  "config_spec": {
                    "redis_config_<Valkey™_version>": {
                      "<setting_1>": "<value_1>",
                      "<setting_2>": "<value_2>",
                      ...
                      "<setting_N>": "<value_N>"
                    }
                  }
                }' \
            mdb.api.cloud.yandex.net:443 \
            yandex.cloud.mdb.redis.v1.ClusterService.Update
        ```

        Where:

        * `update_mask`: List of settings to update as an array of strings (`paths[]`).

        * `config_spec.redis_config_<Valkey™_version>`: Valkey™ settings. Enter each setting on a new line, separated by commas.

            See the [method description](../api-ref/Cluster/update.md#yandex.cloud.mdb.redis.v1.UpdateClusterRequest) for the list of Valkey™ versions supporting this option. See [Valkey™ settings](../concepts/settings-list.md) for descriptions and possible values of the settings.

        You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

    1. Check the [server response](../api-ref/grpc/Cluster/update.md#yandex.cloud.operation.Operation) to make sure your request was successful.

{% endlist %}

## Configuring advanced cluster settings {#change-additional-settings}

{% list tabs group=instructions %}

- Management console {#console}

  1. In the [management console](https://console.yandex.cloud), select the folder containing your cluster.
  1. Navigate to **Yandex Managed Service for&nbsp;Valkey™**.
  1. Select the cluster.
  1. At the top of the page, click **Edit**.
  1. Change additional cluster settings:

     - **Backup start time (UTC)**: Cluster backup start time (UTC, 24-hour format). If you leave the time unset, the [backup](cluster-backups.md) will start at 22:00 UTC.
     
     - **Maintenance**: [Maintenance window](../concepts/maintenance.md) settings:
     
         * To enable maintenance at any time, select **At any time** (default).
         * To specify the preferred maintenance start time, select **By schedule** and specify the day of the week and the UTC time interval. For example, you can choose a time when the cluster is least loaded.
         
         Both active and stopped clusters are subject to maintenance. Maintenance operations include DBMS updates, patches, etc.
     
     - **Deletion protection**: Manages cluster protection against accidental deletion.
     
         Even with deletion protection enabled, one can still connect to the cluster manually and delete the data.
     
     
     - **WebSQL access**: This option enables you to [run SQL queries](web-sql-query.md) against cluster databases from the Yandex Cloud management console using Yandex WebSQL.

  1. Click **Save changes**.

- CLI {#cli}

  If you do not have the Yandex Cloud CLI yet, [install and initialize it](../../cli/quickstart.md#install).

  The folder used by default is the one specified when [creating](../../cli/operations/profile/profile-create.md) the CLI profile. To change the default folder, use the `yc config set folder-id <folder_ID>` command. You can also specify a different folder for any command using `--folder-name` or `--folder-id`. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.

  To change advanced cluster settings:

    1. View the description of the CLI command for updating a cluster:

        ```bash
        yc managed-redis cluster update --help
        ```

    1. Run the following command with the list of settings you want to update:

        
        ```bash
        yc managed-redis cluster update <cluster_name_or_ID> \
            --backup-window-start <time> \
            --maintenance-window type=<maintenance_type>,`
                                `day=<day_of_week>,`
                                `hour=<hour> \
            --websql-access=<true_or_false> \
            --deletion-protection
        ```


    You can update the following settings:

    * `--backup-window-start`: The cluster backup start time, set in UTC format `HH:MM:SS`. If the time is not set, the backup will start at 22:00 UTC.

    * `--maintenance-window`: [Maintenance window](../concepts/maintenance.md) settings (including for stopped clusters), where `type` is the maintenance type:

        * `anytime`: 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`, or `SUN`.
            * `hour`: Sequence number of UTC hour interval, from `1` to `24`.
        
              > For example, `1` stands for the interval from `00:00` to `01:00`, and `5`, from `04:00` to `05:00`.
    
    * `--websql-access`: Enables running [SQL queries](web-sql-query.md) against cluster databases from the Yandex Cloud management console using Yandex WebSQL. The default value is `false`.

    * `--deletion-protection`: Cluster protection from accidental deletion, `true` or `false`.

        Even with deletion protection enabled, one can still connect to the cluster manually and delete the data.

    You can get the cluster name with the [list of clusters in the folder](cluster-list.md#list-clusters).

- Terraform {#tf}

    1. Open the current Terraform configuration file with the infrastructure plan.

        For information on how to create this file, see [Creating a cluster](cluster-create.md).

    1. In the Yandex Managed Service for Valkey™ cluster description, update the settings you need:
    
        * To set the backup start time, add the `backup_window_start` setting to the `config` section:
        
            ```hcl
            resource "yandex_mdb_redis_cluster_v2" "<cluster_name>" {
              ...
              config = {
                ...
                backup_window_start = {
                  hours   = <hours>
                  minutes = <minutes>
                }
            }
            ```

            Where:

            * `hours`: Backup start hour (UTC) in `HH` format, from `0` to `23`.
            * `minutes`: Backup start minute (UTC) in `mm` format, from `0` to `59`.

        * To set the [maintenance window](../concepts/maintenance.md) that will also apply to stopped clusters, add the `maintenance_window` section to the cluster description:

            ```hcl
            resource "yandex_mdb_redis_cluster_v2" "<cluster_name>" {
              ...
              maintenance_window = {
                day  = "<day_of_week>"
                hour = <start_hour>
                type = "ANYTIME"
              }
            }
            ```

            Where `type` is the maintenance type, which can be:

            * `ANYTIME`: At any time.
            * `WEEKLY`: On a schedule. When specifying this value, you also need to set the following:
                * `day`: Day of week in `DDD` format, i.e., `MON`, `TUE`, `WED`, `THU`, `FRI`, `SAT`, or `SUN`.
                * `hour`: Time of day (UTC) in `HH` format, from `1` to `24`.

        * To activate cluster protection against accidental deletion by a user of your cloud, add the `deletion_protection` field set to `true` to the cluster description:

            ```hcl
            resource "yandex_mdb_redis_cluster_v2" "<cluster_name>" {
              ...
              deletion_protection = true
            }
            ```

            Even with deletion protection enabled, one can still connect to the cluster manually and delete the data.

    1. Make sure the settings are correct.

        1. In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.
        1. Run this command:
        
           ```bash
           terraform validate
           ```
        
           Terraform will show any errors found in your configuration files.

    1. Confirm updating the resources.

        1. Run this command to view the planned changes:
        
           ```bash
           terraform plan
           ```
        
           If 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.
        
        1. If everything looks correct, apply the changes:
           1. Run this command:
        
              ```bash
              terraform apply
              ```
        
           1. Confirm updating the resources.
           1. Wait for the operation to complete.

    For more information, see [this Terraform provider guide](../../terraform/resources/mdb_redis_cluster_v2.md).

    {% note warning "Timeouts" %}
    
    The Terraform provider sets the following timeouts for Yandex Managed Service for Valkey™ cluster operations:
    
    * Creating a cluster, including by restoring it from a backup: 15 minutes.
    * Editing a cluster: 60 minutes.
    * Deleting a cluster: 15 minutes.
    
    Operations exceeding the timeout are aborted.
    
    {% cut "How do I change these limits?" %}
    
    Add the `timeouts` section to your cluster description, such as the following:
    
    ```hcl
    resource "yandex_mdb_redis_cluster_v2" "<cluster_name>" {
      ...
      timeouts = {
        create = "1h30m" # 1 hour 30 minutes
        update = "2h"    # 2 hours
        delete = "30m"   # 30 minutes
      }
    }
    ```
    
    {% endcut %}
    
    {% endnote %}

- REST API {#api}

    1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

        ```bash
        export IAM_TOKEN="<IAM_token>"
        ```

    1. Call the [Cluster.Update](../api-ref/Cluster/update.md) method, e.g., via the following [cURL](https://curl.se/) request:

        {% note 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.
        
        {% endnote %}

        ```bash
        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.backupWindowStart,maintenanceWindow,deletionProtection",
                      "configSpec": {
                        "backupWindowStart": {
                          "hours": "<hours>",
                          "minutes": "<minutes>",
                          "seconds": "<seconds>",
                          "nanos": "<nanoseconds>"
                        }
                      },
                      "maintenanceWindow": {
                        "weeklyMaintenanceWindow": {
                          "day": "<day_of_week>",
                          "hour": "<hour>"
                        }
                      },
                      "deletionProtection": <cluster_deletion_protection>
                    }'
        ```

        Where:

        * `updateMask`: Comma-separated string of settings to update.

        * `configSpec.backupWindowStart`: [Backup](../concepts/backup.md) window settings.

            Here, specify the backup start time:

            * `hours`: Between `0` and `23` hours.
            * `minutes`: Between `0` and `59` minutes.
            * `seconds`: Between `0` and `59` seconds.
            * `nanos`: Between `0` and `999999999` nanoseconds.

        * `maintenanceWindow`: [Maintenance window](../concepts/maintenance.md) settings, including for stopped clusters. Provide one of these two parameters:

            * `anytime`: Maintenance takes place at any time.
            * `weeklyMaintenanceWindow`: Maintenance takes place once a week at the specified time:

                * `day`: Day of week in `DDD` format, i.e., `MON`, `TUE`, `WED`, `THU`, `FRI`, `SAT`, or `SUN`.
                * `hour`: Time of day (UTC) in `HH` format, from `1` to `24`.

        * `deletionProtection`: Cluster protection against accidental deletion, `true` or `false`.

            Even with deletion protection enabled, one can still connect to the cluster manually and delete the data.

        You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

    1. Check the [server response](../api-ref/Cluster/update.md#yandex.cloud.operation.Operation) to make sure your request was successful.

- gRPC API {#grpc-api}

    1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

        ```bash
        export IAM_TOKEN="<IAM_token>"
        ```

    1. Clone the [cloudapi](https://github.com/yandex-cloud/cloudapi) repository:
       
       ```bash
       cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
       ```
       
       Below, we assume that the repository contents reside in the `~/cloudapi/` directory.

    1. Call the [ClusterService.Update](../api-ref/grpc/Cluster/update.md) method, e.g., via the following [gRPCurl](https://github.com/fullstorydev/grpcurl) request:

        {% note 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 of `paths[]` strings.
        
        {% cut "Format for listing settings" %}
        
        ```yaml
        "update_mask": {
            "paths": [
                "<setting_1>",
                "<setting_2>",
                ...
                "<setting_N>"
            ]
        }
        ```
        
        {% endcut %}
        
        {% endnote %}

        ```bash
        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.backup_window_start",
                       "maintenance_window",
                       "deletion_protection"
                    ]
                  },
                  "config_spec": {
                    "backup_window_start": {
                      "hours": "<hours>",
                      "minutes": "<minutes>",
                      "seconds": "<seconds>",
                      "nanos": "<nanoseconds>"
                    }
                  },
                  "maintenance_window": {
                    "weekly_maintenance_window": {
                      "day": "<day_of_week>",
                      "hour": "<hour>"
                    }
                  },
                  "deletion_protection": <cluster_deletion_protection>
                }' \
            mdb.api.cloud.yandex.net:443 \
            yandex.cloud.mdb.redis.v1.ClusterService.Update
        ```

        Where:

        * `update_mask`: List of settings to update as an array of strings (`paths[]`).

        * `config_spec.backup_window_start`: [Backup](../concepts/backup.md) window settings.

            Here, specify the backup start time:

            * `hours`: Between `0` and `23` hours.
            * `minutes`: Between `0` and `59` minutes.
            * `seconds`: Between `0` and `59` seconds.
            * `nanos`: Between `0` and `999999999` nanoseconds.

        * `maintenance_window`: [Maintenance](../concepts/maintenance.md) window settings, including for stopped clusters. Provide one of these two parameters:

            * `anytime`: Maintenance takes place at any time.
            * `weekly_maintenance_window`: Maintenance takes place once a week at the specified time:

                * `day`: Day of week in `DDD` format, i.e., `MON`, `TUE`, `WED`, `THU`, `FRI`, `SAT`, or `SUN`.
                * `hour`: Time of day (UTC) in `HH` format, from `1` to `24`.

        * `deletion_protection`: Cluster protection against accidental deletion, `true` or `false`.

            Even with deletion protection enabled, one can still connect to the cluster manually and delete the data.

        You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

    1. Check the [server response](../api-ref/grpc/Cluster/update.md#yandex.cloud.operation.Operation) to make sure your request was successful.

{% endlist %}

## Enabling sharding {#enable-sharding}

You can enable [sharding](../concepts/sharding.md) in a non-sharded cluster to make it a sharded one.

{% note warning %}

You cannot disable sharding in a cluster where it is already enabled.

{% endnote %}

{% list tabs group=instructions %}

- Management console {#console}

    1. In the [management console](https://console.yandex.cloud), select the folder containing your cluster.
    1. Navigate to **Yandex Managed Service for&nbsp;Valkey™**.
    1. Select the cluster.
    1. At the top of the page, click **Edit**.
    1. Under **Basic parameters**, enable **Cluster sharding**.
    1. Click **Save changes**.

    Enabling sharding will place all existing cluster hosts into a single shard named `shard1`.

- CLI {#cli}

    If you do not have the Yandex Cloud CLI yet, [install and initialize it](../../cli/quickstart.md#install).

    The folder used by default is the one specified when [creating](../../cli/operations/profile/profile-create.md) the CLI profile. To change the default folder, use the `yc config set folder-id <folder_ID>` command. You can also specify a different folder for any command using `--folder-name` or `--folder-id`. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.

    To enable sharding:

    1. See the description of the CLI command for enabling sharding:

        ```bash
        yc managed-redis cluster enable-sharding --help
        ```

    1. Run this command:

        ```bash
        yc managed-redis cluster enable-sharding <cluster_ID>
        ```

        You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

    Enabling sharding will place all existing cluster hosts into a single shard named `shard1`.

- Terraform {#tf}

    To enable sharding:

    1. Open the current Terraform configuration file with the infrastructure plan.

        For information on how to create this file, see [Creating a cluster](cluster-create.md).

    1. Add the `sharded` argument set to `true` to the Yandex Managed Service for Valkey™ cluster description:

        ```hcl
        resource "yandex_mdb_redis_cluster_v2" "<cluster_name>" {
          ...
          sharded = true
        }
        ```

    1. Make sure the settings are correct.

        1. In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.
        1. Run this command:
        
           ```bash
           terraform validate
           ```
        
           Terraform will show any errors found in your configuration files.

    1. Confirm updating the resources.

        1. Run this command to view the planned changes:
        
           ```bash
           terraform plan
           ```
        
           If 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.
        
        1. If everything looks correct, apply the changes:
           1. Run this command:
        
              ```bash
              terraform apply
              ```
        
           1. Confirm updating the resources.
           1. Wait for the operation to complete.

    Enabling sharding will place all existing cluster hosts into a single shard named `shard1`.

    You can also [manage shards](shards.md).

    For more information, see [this Terraform provider guide](../../terraform/resources/mdb_redis_cluster_v2.md).

    {% note warning "Timeouts" %}
    
    The Terraform provider sets the following timeouts for Yandex Managed Service for Valkey™ cluster operations:
    
    * Creating a cluster, including by restoring it from a backup: 15 minutes.
    * Editing a cluster: 60 minutes.
    * Deleting a cluster: 15 minutes.
    
    Operations exceeding the timeout are aborted.
    
    {% cut "How do I change these limits?" %}
    
    Add the `timeouts` section to your cluster description, such as the following:
    
    ```hcl
    resource "yandex_mdb_redis_cluster_v2" "<cluster_name>" {
      ...
      timeouts = {
        create = "1h30m" # 1 hour 30 minutes
        update = "2h"    # 2 hours
        delete = "30m"   # 30 minutes
      }
    }
    ```
    
    {% endcut %}
    
    {% endnote %}

- REST API {#api}

    1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

        ```bash
        export IAM_TOKEN="<IAM_token>"
        ```

    1. Call the [Cluster.EnableSharding](../api-ref/Cluster/enableSharding.md) method, e.g., via the following [cURL](https://curl.se/) request:

        ```bash
        curl \
            --request POST \
            --header "Authorization: Bearer $IAM_TOKEN" \
            --url 'https://mdb.api.cloud.yandex.net/managed-redis/v1/clusters/<cluster_ID>:enable_sharding'
        ```

        You can request the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

        Enabling sharding will place all existing cluster hosts into a single shard named `shard1`.

    1. Check the [server response](../api-ref/Cluster/enableSharding.md#yandex.cloud.operation.Operation) to make sure your request was successful.

- gRPC API {#grpc-api}

    1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

        ```bash
        export IAM_TOKEN="<IAM_token>"
        ```

    1. Clone the [cloudapi](https://github.com/yandex-cloud/cloudapi) repository:
       
       ```bash
       cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
       ```
       
       Below, we assume that the repository contents reside in the `~/cloudapi/` directory.

    1. Call the [ClusterService.EnableSharding](../api-ref/grpc/Cluster/enableSharding.md) method, e.g., via the following [gRPCurl](https://github.com/fullstorydev/grpcurl) request:

        ```bash
        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>"
                }' \
            mdb.api.cloud.yandex.net:443 \
            yandex.cloud.mdb.redis.v1.ClusterService.EnableSharding
        ```

        You can request the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

        Enabling sharding will place all existing cluster hosts into a single shard named `shard1`.

    1. Check the [server response](../api-ref/grpc/Cluster/enableSharding.md#yandex.cloud.operation.Operation) to make sure your request was successful.

{% endlist %}

## Moving a cluster {#move-cluster}

{% list tabs group=instructions %}

- Management console {#console}

    1. Navigate to **Yandex Managed Service for&nbsp;Valkey™**.
    1. Click ![image](../../_assets/console-icons/ellipsis.svg) next to the cluster you want to move.
    1. Select **Move**.
    1. Select the destination folder for your cluster.
    1. Click **Move**.

- CLI {#cli}

    If you do not have the Yandex Cloud CLI yet, [install and initialize it](../../cli/quickstart.md#install).

    The folder used by default is the one specified when [creating](../../cli/operations/profile/profile-create.md) the CLI profile. To change the default folder, use the `yc config set folder-id <folder_ID>` command. You can also specify a different folder for any command using `--folder-name` or `--folder-id`. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.

    To move a cluster:

    1. View the description of the CLI command for moving a cluster:

        ```bash
        yc managed-redis cluster move --help
        ```

    1. Specify the destination folder in the cluster move command:

        ```bash
        yc managed-redis cluster move <cluster_ID> \
           --destination-folder-name=<destination_folder_name>
        ```

        You can get the cluster ID from the [list of clusters in your folder](cluster-list.md#list-clusters).

- Terraform {#tf}

    1. Open the current Terraform configuration file with the infrastructure plan.

        For information on how to create this file, see [Creating a cluster](cluster-create.md).

    1. In the Yandex Managed Service for Valkey™ cluster description, add or update the `folder_id` argument:

        ```hcl
        resource "yandex_mdb_redis_cluster_v2" "<cluster_name>" {
          ...
          folder_id = "<destination_folder_ID>"
        }
        ```

    1. Make sure the settings are correct.

        1. In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.
        1. Run this command:
        
           ```bash
           terraform validate
           ```
        
           Terraform will show any errors found in your configuration files.

    1. Confirm updating the resources.

        1. Run this command to view the planned changes:
        
           ```bash
           terraform plan
           ```
        
           If 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.
        
        1. If everything looks correct, apply the changes:
           1. Run this command:
        
              ```bash
              terraform apply
              ```
        
           1. Confirm updating the resources.
           1. Wait for the operation to complete.

    For more information, see [this Terraform provider guide](../../terraform/resources/mdb_redis_cluster_v2.md).

    {% note warning "Timeouts" %}
    
    The Terraform provider sets the following timeouts for Yandex Managed Service for Valkey™ cluster operations:
    
    * Creating a cluster, including by restoring it from a backup: 15 minutes.
    * Editing a cluster: 60 minutes.
    * Deleting a cluster: 15 minutes.
    
    Operations exceeding the timeout are aborted.
    
    {% cut "How do I change these limits?" %}
    
    Add the `timeouts` section to your cluster description, such as the following:
    
    ```hcl
    resource "yandex_mdb_redis_cluster_v2" "<cluster_name>" {
      ...
      timeouts = {
        create = "1h30m" # 1 hour 30 minutes
        update = "2h"    # 2 hours
        delete = "30m"   # 30 minutes
      }
    }
    ```
    
    {% endcut %}
    
    {% endnote %}

- REST API {#api}

    1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

        ```bash
        export IAM_TOKEN="<IAM_token>"
        ```

    1. Call the [Cluster.Move](../api-ref/Cluster/move.md) method, e.g., via the following [cURL](https://curl.se/) request:

        ```bash
        curl \
            --request POST \
            --header "Authorization: Bearer $IAM_TOKEN" \
            --header "Content-Type: application/json" \
            --url 'https://mdb.api.cloud.yandex.net/managed-redis/v1/clusters/<cluster_ID>:move' \
            --data '{
                      "destinationFolderId": "<folder_ID>"
                    }'
        ```

        Where `destinationFolderId` is the ID of the folder to move your cluster to.

        You can request the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters) and the folder ID, with the [list of folders in the cloud](../../resource-manager/operations/folder/get-id.md).

    1. Check the [server response](../api-ref/Cluster/move.md#yandex.cloud.operation.Operation) to make sure your request was successful.

- gRPC API {#grpc-api}

    1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

        ```bash
        export IAM_TOKEN="<IAM_token>"
        ```

    1. Clone the [cloudapi](https://github.com/yandex-cloud/cloudapi) repository:
       
       ```bash
       cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
       ```
       
       Below, we assume that the repository contents reside in the `~/cloudapi/` directory.

    1. Call the [ClusterService.Move](../api-ref/grpc/Cluster/move.md) method, e.g., via the following [gRPCurl](https://github.com/fullstorydev/grpcurl) request:

        ```bash
        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>",
                  "destination_folder_id": "<folder_ID>"
                }' \
            mdb.api.cloud.yandex.net:443 \
            yandex.cloud.mdb.redis.v1.ClusterService.Move
        ```

        Where `destination_folder_id` is the ID of the folder to move your cluster to.

        You can request the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters) and the folder ID, with the [list of folders in the cloud](../../resource-manager/operations/folder/get-id.md).

    1. Check the [server response](../api-ref/grpc/Cluster/move.md#yandex.cloud.operation.Operation) to make sure your request was successful.

{% endlist %}


## Updating security groups {#change-sg-set}

{% list tabs group=instructions %}

- Management console {#console}

    1. In the [management console](https://console.yandex.cloud), select the folder containing your cluster.
    1. Navigate to **Yandex Managed Service for&nbsp;Valkey™**.
    1. Select the cluster.
    1. At the top of the page, click **Edit**.
    1. Under **Network settings**, select the security groups for cluster network traffic.

- CLI {#cli}

    If you do not have the Yandex Cloud CLI yet, [install and initialize it](../../cli/quickstart.md#install).

    The folder used by default is the one specified when [creating](../../cli/operations/profile/profile-create.md) the CLI profile. To change the default folder, use the `yc config set folder-id <folder_ID>` command. You can also specify a different folder for any command using `--folder-name` or `--folder-id`. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.

    To change the list of [security groups](../concepts/network.md#security-groups) for your cluster:

    1. See the description of the CLI command for updating a cluster:

        ```bash
        yc managed-redis cluster update --help
        ```

    1. Specify the security groups in the cluster update command:

        ```bash
        yc managed-redis cluster update <cluster_name_or_ID> \
          --security-group-ids <list_of_security_group_IDs>
        ```

- Terraform {#tf}

    1. Open the current Terraform configuration file with the infrastructure plan.

        For information on how to create this file, see [Creating a cluster](cluster-create.md).

    1. Update the `security_group_ids` value in the Yandex Managed Service for Valkey™ cluster description:

        ```hcl
        resource "yandex_mdb_redis_cluster_v2" "<cluster_name>" {
          ...
          security_group_ids = [ "<list_of_security_group_IDs>" ]
        }
        ```

    1. Make sure the settings are correct.

        1. In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.
        1. Run this command:
        
           ```bash
           terraform validate
           ```
        
           Terraform will show any errors found in your configuration files.

    1. Confirm updating the resources.

        1. Run this command to view the planned changes:
        
           ```bash
           terraform plan
           ```
        
           If 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.
        
        1. If everything looks correct, apply the changes:
           1. Run this command:
        
              ```bash
              terraform apply
              ```
        
           1. Confirm updating the resources.
           1. Wait for the operation to complete.

    For more information, see [this Terraform provider guide](../../terraform/resources/mdb_redis_cluster_v2.md).

    {% note warning "Timeouts" %}
    
    The Terraform provider sets the following timeouts for Yandex Managed Service for Valkey™ cluster operations:
    
    * Creating a cluster, including by restoring it from a backup: 15 minutes.
    * Editing a cluster: 60 minutes.
    * Deleting a cluster: 15 minutes.
    
    Operations exceeding the timeout are aborted.
    
    {% cut "How do I change these limits?" %}
    
    Add the `timeouts` section to your cluster description, such as the following:
    
    ```hcl
    resource "yandex_mdb_redis_cluster_v2" "<cluster_name>" {
      ...
      timeouts = {
        create = "1h30m" # 1 hour 30 minutes
        update = "2h"    # 2 hours
        delete = "30m"   # 30 minutes
      }
    }
    ```
    
    {% endcut %}
    
    {% endnote %}

- REST API {#api}

    1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

        ```bash
        export IAM_TOKEN="<IAM_token>"
        ```

    1. Call the [Cluster.Update](../api-ref/Cluster/update.md) method, e.g., via the following [cURL](https://curl.se/) request:

        {% note 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.
        
        {% endnote %}

        ```bash
        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": "securityGroupIds",
                      "securityGroupIds": [
                        "<security_group_1_ID>",
                        "<security_group_2_ID>",
                        ...
                        "<security_group_N_ID>"
                      ]
                    }'
        ```

        Where:

        * `updateMask`: Comma-separated string of settings to update.

            Here, we provide only one setting.

        * `securityGroupIds`: [Security group](../concepts/network.md#security-groups) IDs.

        You can request the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

    1. Check the [server response](../api-ref/Cluster/update.md#yandex.cloud.operation.Operation) to make sure your request was successful.

- gRPC API {#grpc-api}

    1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

        ```bash
        export IAM_TOKEN="<IAM_token>"
        ```

    1. Clone the [cloudapi](https://github.com/yandex-cloud/cloudapi) repository:
       
       ```bash
       cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
       ```
       
       Below, we assume that the repository contents reside in the `~/cloudapi/` directory.

    1. Call the [ClusterService.Update](../api-ref/grpc/Cluster/update.md) method, e.g., via the following [gRPCurl](https://github.com/fullstorydev/grpcurl) request:

        {% note 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 of `paths[]` strings.
        
        {% cut "Format for listing settings" %}
        
        ```yaml
        "update_mask": {
            "paths": [
                "<setting_1>",
                "<setting_2>",
                ...
                "<setting_N>"
            ]
        }
        ```
        
        {% endcut %}
        
        {% endnote %}

        ```bash
        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": [ "security_group_ids" ]
                  },
                  "security_group_ids": [
                    "<security_group_1_ID>",
                    "<security_group_2_ID>",
                    ...
                    "<security_group_N_ID>"
                  ] 
                }' \
            mdb.api.cloud.yandex.net:443 \
            yandex.cloud.mdb.redis.v1.ClusterService.Update
        ```

        Where:

        * `update_mask`: List of settings you want to update as an array of strings (`paths[]`).

            Here, we provide only one setting.

        * `security_group_ids`: [Security group](../concepts/network.md#security-groups) IDs.

        You can request the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

    1. Check the [server response](../api-ref/grpc/Cluster/update.md#yandex.cloud.operation.Operation) to make sure your request was successful.

{% endlist %}

{% note warning %}

You may need to [configure security groups](connect/index.md#configuring-security-groups) to enable access to your cluster.

{% endnote %}