Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
    • Yandex Cloud Partner program
  • Blog
  • Pricing
  • Documentation
© 2025 Direct Cursus Technology L.L.C.
Yandex Managed Service for Valkey™
  • Getting started
    • All guides
      • Managing shards
      • Switching the master
  • Access management
  • Pricing policy
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Public materials
  • Release notes
  • FAQ

In this article:

  • Listing shards in a cluster
  • Getting detailed information about a shard
  • Creating a shard
  • Deleting a shard
  • Rebalancing a cluster
  1. Step-by-step guides
  2. Sharding and fault-tolerance
  3. Managing shards

Managing cluster shards

Written by
Yandex Cloud
Updated at May 13, 2025
  • Listing shards in a cluster
  • Getting detailed information about a shard
  • Creating a shard
  • Deleting a shard
  • Rebalancing a cluster

You can add and remove cluster shards, request a list of shards in the selected cluster, and rebalance your cluster.

Warning

You can only manage shards in sharded clusters.

You can create a sharded cluster or enable sharding in an existing non-sharded cluster.

Listing shards in a clusterListing shards in a cluster

Management console
CLI
REST API
gRPC API
  1. In the management console, select the folder with the cluster you need.
  2. Select Yandex Managed Service for Valkey™.
  3. Click the name of the cluster you need and select the Shards tab.

If you do not have the Yandex Cloud (CLI) command line interface yet, install and initialize it.

The folder specified when creating the CLI profile is used by default. To change the default folder, use the yc config set folder-id <folder_ID> command. You can specify a different folder using the --folder-name or --folder-id parameter.

To get a list of shards in a cluster, run the following command:

yc managed-redis shards list --cluster-name <cluster_name>

Result:

+--------------+
|     NAME     |
+--------------+
| test-shard-1 |
| test-shard-2 |
| test-shard-3 |
+--------------+
  1. Get an IAM token for API authentication and put it into the environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Use the Cluster.ListShards method and make a request, e.g., via cURL:

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

    You can get the cluster ID with a list of clusters in the folder.

  3. View the server response to make sure the request was successful.

  1. Get an IAM token for API authentication and put it into the environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Clone the cloudapi repository:

    cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
    

    Below, we assume the repository contents are stored in the ~/cloudapi/ directory.

  3. Use the ClusterService.ListShards call and make a request, e.g., via gRPCurl:

    grpcurl \
        -format json \
        -import-path ~/cloudapi/ \
        -import-path ~/cloudapi/third_party/googleapis/ \
        -proto ~/cloudapi/yandex/cloud/mdb/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.ListShards
    

    You can get the cluster ID with a list of clusters in the folder.

  4. View the server response to make sure the request was successful.

Getting detailed information about a shardGetting detailed information about a shard

CLI
REST API
gRPC API

If you do not have the Yandex Cloud (CLI) command line interface yet, install and initialize it.

The folder specified when creating the CLI profile is used by default. To change the default folder, use the yc config set folder-id <folder_ID> command. You can specify a different folder using the --folder-name or --folder-id parameter.

To get information about a shard, run the following command:

yc managed-redis shards get <shard_name> --cluster-name <cluster_name>
  1. Get an IAM token for API authentication and put it into the environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Use the Cluster.GetShard method and make a request, e.g., via cURL:

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

    You can request the cluster ID with a list of clusters in a folder and the shard name with a list of shards in a cluster.

  3. View the server response to make sure the request was successful.

  1. Get an IAM token for API authentication and put it into the environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Clone the cloudapi repository:

    cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
    

    Below, we assume the repository contents are stored in the ~/cloudapi/ directory.

  3. Use the ClusterService.GetShard call and make a request, e.g., via gRPCurl:

    grpcurl \
        -format json \
        -import-path ~/cloudapi/ \
        -import-path ~/cloudapi/third_party/googleapis/ \
        -proto ~/cloudapi/yandex/cloud/mdb/redis/v1/cluster_service.proto \
        -rpc-header "Authorization: Bearer $IAM_TOKEN" \
        -d '{
              "cluster_id": "<cluster_ID>",
              "shard_name": "<shard_name>"
            }' \
        mdb.api.cloud.yandex.net:443 \
        yandex.cloud.mdb.redis.v1.ClusterService.GetShard
    

    You can request the cluster ID with a list of clusters in a folder and the shard name with a list of shards in a cluster.

  4. View the server response to make sure the request was successful.

You can request the shard name with a list of cluster shards and the cluster name with a list of clusters in a folder.

Creating a shardCreating a shard

For clusters with the local-ssd disk type, the minimum allowed number of hosts per shard is two.

Management console
CLI
Terraform
REST API
gRPC API

To add a shard:

  1. Go to the folder page and select Yandex Managed Service for Valkey™.
  2. Click the cluster name and go to the Shards tab.
  3. Click Create shard.
  4. Specify Shard name.
  5. Under Hosts:
    • (Optional) Edit the host settings.
    • Click Add host.
    • In the Availability zone field, choose the availability zone, select Subnet, and enable the Public access option.
  6. Click Create shard.

If you do not have the Yandex Cloud (CLI) command line interface yet, install and initialize it.

The folder specified when creating the CLI profile is used by default. To change the default folder, use the yc config set folder-id <folder_ID> command. You can specify a different folder using the --folder-name or --folder-id parameter.

View a description of the CLI command for adding a shard:

yc managed-redis shards add --help

To create a shard of two hosts, one with public access and the other with a host priority of 50, run this command:

yc managed-redis shards add --name=<new_shard_name> \
  --cluster-name=<cluster_name> \
  --host zone-id=<availability_zone>,`
    `subnet-name=<subnet_name>,`
    `assign-public-ip=true \
  --host zone-id=<availability_zone>,`
    `subnet-name=<subnet_name>,`
    `replica-priority=50

To add a shard:

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

    For more information about creating this file, see Creating clusters.

  2. Add the required number of host sections to the Yandex Managed Service for Valkey™ cluster description and specify the shard name in the shard_name parameter:

    resource "yandex_mdb_redis_cluster" "<cluster_name>" {
      ...
      host {
        zone             = "<availability_zone>"
        subnet_id        = <subnet_ID>
        assign_public_ip = <public_access>
        replica_priority = <host_priority>
        shard_name       = "<shard_name>"
      }
    }
    

    Where assign_public_ip is public access to the host, true or false.

  3. 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.

    2. Run this command:

      terraform validate
      

      Terraform will show any errors found in your configuration files.

  4. Confirm updating the resources.

    1. Run this command to view the planned changes:

      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.

    2. If everything looks correct, apply the changes:

      1. Run this command:

        terraform apply
        
      2. Confirm updating the resources.

      3. Wait for the operation to complete.

For more information, see the Terraform provider documentation.

Time limits

A Terraform provider sets the timeout for Yandex Managed Service for Valkey™ cluster operations:

  • Creating a cluster, including by restoring one from a backup: 15 minutes.
  • Editing a cluster: 60 minutes.
  • Deleting a cluster: 15 minutes.

Operations exceeding the set timeout are interrupted.

How do I change these limits?

Add the timeouts block to the cluster description, for example:

resource "yandex_mdb_redis_cluster" "<cluster_name>" {
  ...
  timeouts {
    create = "1h30m" # 1 hour 30 minutes
    update = "2h"    # 2 hours
    delete = "30m"   # 30 minutes
  }
}
  1. Get an IAM token for API authentication and put it into the environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Use the Cluster.AddShard method and make a request, e.g., via cURL:

    curl \
        --request POST \
        --header "Authorization: Bearer $IAM_TOKEN" \
        --header "Content-Type: application/json" \
        --url 'https://mdb.api.cloud.yandex.net/managed-redis/v1/clusters/<cluster_ID>/shards' \
        --data '{
                  "shardName": "<shard_name>",
                  "hostSpecs": [
                    {
                      "zoneId": "<availability_zone>",
                      "subnetId": "<subnet_ID>",
                      "shardName": "<shard_name>",
                      "replicaPriority": "<host_priority>",
                      "assignPublicIp": <public_access_to_cluster_host>
                    },
                    { <similar_configuration_for_host_2> },
                    { ... },
                    { <similar_configuration_for_host_N> }
                  ]
                }'
    

    Where:

    • shardName: Name of the shard you are creating.

    • hostSpecs: Host parameters:

      • zoneId: Availability zone.
      • subnetId: Subnet ID. Specify if two or more subnets are created in the selected availability zone.
      • shardName: Shard name for the host.
      • replicaPriority: Priority for assigning the host as a master if the primary master fails.
      • assignPublicIp: Internet access to the host via a public IP address, true or false. You can enable public access only if TLS support is enabled in the cluster.

    You can get the cluster ID with a list of clusters in the folder.

  3. View the server response to make sure the request was successful.

  1. Get an IAM token for API authentication and put it into the environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Clone the cloudapi repository:

    cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
    

    Below, we assume the repository contents are stored in the ~/cloudapi/ directory.

  3. Use the ClusterService.AddShard call and make a request, e.g., via gRPCurl:

    grpcurl \
        -format json \
        -import-path ~/cloudapi/ \
        -import-path ~/cloudapi/third_party/googleapis/ \
        -proto ~/cloudapi/yandex/cloud/mdb/redis/v1/cluster_service.proto \
        -rpc-header "Authorization: Bearer $IAM_TOKEN" \
        -d '{
              "cluster_id": "<cluster_ID>",
              "shard_name": "<shard_name>",
              "host_specs": [
                {
                  "zone_id": "<availability_zone>",
                  "subnet_id": "<subnet_ID>",
                  "shard_name": "<shard_name>",
                  "replica_priority": "<host_priority>",
                  "assign_public_ip": <public_access_to_cluster_host>
                },
                { <similar_configuration_for_host_2> },
                { ... },
                { <similar_configuration_for_host_N> }
              ]
            }' \
        mdb.api.cloud.yandex.net:443 \
        yandex.cloud.mdb.redis.v1.ClusterService.AddShard
    

    Where:

    • shard_name: Name of the shard you are creating.

    • host_specs: Host parameters:

      • zone_id: Availability zone.
      • subnet_id: Subnet ID. Specify if two or more subnets are created in the selected availability zone.
      • shard_name: Shard name for the host.
      • replica_priority: Priority for assigning the host as a master if the primary master fails.
      • assign_public_ip: Internet access to the host via a public IP address, true or false. You can enable public access only if TLS support is enabled in the cluster.

    You can get the cluster ID with a list of clusters in the folder.

To be able to place data in the new shard, start rebalancing the Yandex Managed Service for Valkey™ cluster.

Deleting a shardDeleting a shard

Alert

  • All the shard hosts are deleted with the shard.
  • If a cluster has two or three shards, use the CLI, Terraform, or API to delete a shard.
Management console
CLI
Terraform
REST API
gRPC API
  1. In the management console, go to the folder containing the cluster to delete the shard from.
  2. Select Yandex Managed Service for Valkey™.
  3. Click the cluster name and open the Shards tab.
  4. In the line with the shard, click and select Delete.
  5. In the window that opens, click Remove.

If you do not have the Yandex Cloud (CLI) command line interface yet, install and initialize it.

The folder specified when creating the CLI profile is used by default. To change the default folder, use the yc config set folder-id <folder_ID> command. You can specify a different folder using the --folder-name or --folder-id parameter.

To delete a shard from the cluster, run:

yc managed-redis shards delete <shard_name> \
  --cluster-name=<cluster_name>

You can request the shard name with a list of cluster shards and the cluster name with a list of clusters in a folder.

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

    For more information about creating this file, see Creating clusters.

  2. Delete all shard-related host blocks from the Yandex Managed Service for Valkey™ cluster description.

  3. 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.

    2. Run this command:

      terraform validate
      

      Terraform will show any errors found in your configuration files.

  4. Type yes and press Enter.

    1. Run this command to view the planned changes:

      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.

    2. If everything looks correct, apply the changes:

      1. Run this command:

        terraform apply
        
      2. Confirm updating the resources.

      3. Wait for the operation to complete.

For more information, see the Terraform provider documentation.

Time limits

A Terraform provider sets the timeout for Yandex Managed Service for Valkey™ cluster operations:

  • Creating a cluster, including by restoring one from a backup: 15 minutes.
  • Editing a cluster: 60 minutes.
  • Deleting a cluster: 15 minutes.

Operations exceeding the set timeout are interrupted.

How do I change these limits?

Add the timeouts block to the cluster description, for example:

resource "yandex_mdb_redis_cluster" "<cluster_name>" {
  ...
  timeouts {
    create = "1h30m" # 1 hour 30 minutes
    update = "2h"    # 2 hours
    delete = "30m"   # 30 minutes
  }
}
  1. Get an IAM token for API authentication and put it into the environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Use the Cluster.DeleteShard method and make a request, e.g., via cURL:

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

    You can request the cluster ID with a list of clusters in a folder and the shard name with a list of shards in a cluster.

  3. View the server response to make sure the request was successful.

  1. Get an IAM token for API authentication and put it into the environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Clone the cloudapi repository:

    cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
    

    Below, we assume the repository contents are stored in the ~/cloudapi/ directory.

  3. Use the ClusterService.DeleteShard call and make a request, e.g., via gRPCurl:

    grpcurl \
        -format json \
        -import-path ~/cloudapi/ \
        -import-path ~/cloudapi/third_party/googleapis/ \
        -proto ~/cloudapi/yandex/cloud/mdb/redis/v1/cluster_service.proto \
        -rpc-header "Authorization: Bearer $IAM_TOKEN" \
        -d '{
              "cluster_id": "<cluster_ID>",
              "shard_name": "<shard_name>" 
            }' \
        mdb.api.cloud.yandex.net:443 \
        yandex.cloud.mdb.redis.v1.ClusterService.DeleteShard
    

    You can request the cluster ID with a list of clusters in a folder and the shard name with a list of shards in a cluster.

  4. View the server response to make sure the request was successful.

Rebalancing a clusterRebalancing a cluster

New shards are created without hash slots and can't accept data. To begin populating a new shard with data, rebalance the cluster to allocate some of its hash slots to the new shard. The cluster will move the data in the reassigned hash slots to the appropriate shard. Rebalancing can be performed on a running cluster and does not affect data availability or integrity.

For more information, see Scalability.

Management console
CLI
REST API
gRPC API

To rebalance a cluster:

  1. In the management console, select the folder with the cluster you need.
  2. Select Yandex Managed Service for Valkey™.
  3. Click the cluster name.
  4. In the Overview tab, click Rebalance.

Tip

You can also rebalance a cluster using the Rebalance cluster button on the Shards tab.

If you do not have the Yandex Cloud (CLI) command line interface yet, install and initialize it.

The folder specified when creating the CLI profile is used by default. To change the default folder, use the yc config set folder-id <folder_ID> command. You can specify a different folder using the --folder-name or --folder-id parameter.

To rebalance a cluster, run the command below:

yc managed-redis cluster rebalance \
  --name=<cluster_name>

You can request the cluster name with a list of clusters in the folder.

  1. Get an IAM token for API authentication and put it into the environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Use the Cluster.Rebalance method and make a request, e.g., via cURL:

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

    You can get the cluster ID with a list of clusters in the folder.

  3. View the server response to make sure the request was successful.

  1. Get an IAM token for API authentication and put it into the environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Clone the cloudapi repository:

    cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
    

    Below, we assume the repository contents are stored in the ~/cloudapi/ directory.

  3. Use the ClusterService.Rebalance call and make a request, e.g., via gRPCurl:

    grpcurl \
        -format json \
        -import-path ~/cloudapi/ \
        -import-path ~/cloudapi/third_party/googleapis/ \
        -proto ~/cloudapi/yandex/cloud/mdb/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.Rebalance
    

    You can get the cluster ID with a list of clusters in the folder.

  4. View the server response to make sure the request was successful.

Was the article helpful?

Previous
Queries in Yandex WebSQL
Next
Switching the master
© 2025 Direct Cursus Technology L.L.C.