Managing cluster shards

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

Important

You can only manage shards in sharded clusters. Existing non-sharded clusters can't be sharded later. To create a sharded cluster, see Creating clusters.

List shards in a cluster

  1. Go to the folder page and select Managed Service for Redis.

  2. Click the name of a cluster and open the Shards tab.

If you don't have the Yandex.Cloud command line interface yet, install it.

The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name or --folder-id parameter.

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

$ yc managed-redis shards list --name <cluster name>
+--------------+
|     NAME     |
+--------------+
| test-shard-1 |
| test-shard-2 |
| test-shard-3 |
| test-shard-4 |
| test-shard-5 |
+--------------+

Getting detailed information about a shard

If you don't have the Yandex.Cloud command line interface yet, install it.

The folder specified in the CLI profile is used by default. 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> --name <cluster name>

The cluster name and ID can be requested with a list of clusters in the folder.

Add a shard

  1. Go to the folder page and select Managed Service for Redis.

  2. Click on the name of the cluster and go to the Shards tab.

  3. Click Add shard.

  4. Specify the shard parameters:

    • Name of the shard.
    • Availability zones.
    • Add more hosts to the shard if needed.
  5. Click Create shard.

After adding a new shard, you must rebalance your cluster:

  1. Wait until the cluster status changes to Running.
  2. Open the Hosts tab and click Rebalance cluster. Press OK.

If you don't have the Yandex.Cloud command line interface yet, install it.

The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name or --folder-id parameter.

To add a two-host shard to the cluster:

$ yc managed-redis shards add --name <name of the new shard> --name <cluster name> \
  --host zone-id=<availability zone>,subnet-name=<subnet name> \
  --host zone-id=<availability zone>,subnet-name=<subnet name>

After adding a new shard, you must rebalance your cluster:

$ yc managed-redis cluster --name test-sharding-2 rebalance 

Delete a shard

Warning

All the shard hosts are deleted with the shard.

  1. Go to the folder page and select Managed Service for Redis.

  2. Click on the name of a cluster and open the Shards tab.

  3. Click image in the row of the shard, then click Delete in the menu that opens.

  4. In the window that opens, click Delete.

If you don't have the Yandex.Cloud command line interface yet, install it.

The folder specified in the CLI profile is used by default. 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>
     --name=<cluster name>

The shard name can be requested with a list of cluster shards, and the cluster name can be requested with a list of clusters in the folder.