Managing Valkey™ cluster hosts
You can add and remove cluster hosts and manage their settings. For information about moving cluster hosts to a different availability zone, see this guide.
Getting a list of cluster hosts
- Navigate to the folder dashboard
and select Yandex Managed Service for Valkey™. - Click the cluster name and select the Hosts tab.
If you do not have the Yandex Cloud CLI installed yet, install and initialize it.
By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id parameter.
To get a list of cluster hosts, run this command:
yc managed-redis host list \
--cluster-name=<cluster_name>
Result:
+---------------------------------+----------------------+------------+---------+--------+-------------------+
| NAME | CLUSTER ID | SHARD NAME | ROLE | HEALTH | ZONE ID |
+---------------------------------+----------------------+------------+---------+--------+-------------------+
| rc1a-...caf.mdb.yandexcloud.net | c9qb2q230gg1******** | shard1 | MASTER | ALIVE | ru-central1-a |
| rc1b-...bgc.mdb.yandexcloud.net | c9qb2q230gg1******** | shard1 | REPLICA | ALIVE | ru-central1-b |
+---------------------------------+----------------------+------------+---------+--------+-------------------+
You can get the cluster name from the folder’s cluster list.
-
Get an IAM token for API authentication and place it in an environment variable:
export IAM_TOKEN="<IAM_token>" -
Use the Cluster.ListHosts method and send the following 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>/hosts'You can request the cluster ID with the list of clusters in the folder.
-
Check the server response to make sure your request was successful.
-
Get an IAM token for API authentication and place it in an environment variable:
export IAM_TOKEN="<IAM_token>" -
Clone the cloudapi
repository:cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapiBelow, we assume the repository contents are stored in the
~/cloudapi/directory. -
Use the ClusterService.ListHosts call and send the following request, e.g., via gRPCurl
:grpcurl \ -format json \ -import-path ~/cloudapi/ \ -import-path ~/cloudapi/third_party/googleapis/ \ -proto ~/cloudapi/yandex/cloud/mdb/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.ListHostsYou can request the cluster ID with the list of clusters in the folder.
-
Check the server response to make sure your request was successful.
Creating a host
The number of hosts in Yandex Managed Service for Valkey™ clusters is limited by the CPU and RAM quotas available to DB clusters in your cloud. To check the resources currently in use, open the Quotas
Note
Public access to hosts can only be configured for clusters created with enabled TLS support.
To create a host:
- Navigate to the folder dashboard
and select Yandex Managed Service for Valkey™. - Click the cluster name and navigate to the Hosts tab.
- Click Create host.
- Specify the host parameters:
-
Availability zone.
-
Subnet (if the required subnet is not on the list, create it).
-
If necessary, configure public access to the host.
-
If you are adding a host to a sharded cluster, select a shard.
-
If you do not have the Yandex Cloud CLI installed yet, install and initialize it.
By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id parameter.
To create a host:
-
Request the list of cluster subnets to select one for the new host:
yc vpc subnet listResult:
+----------------------+-----------+-----------------------+---------------+------------------+ | ID | NAME | NETWORK ID | ZONE | RANGE | +----------------------+-----------+-----------------------+---------------+------------------+ | b0cl69a2b4c6******** | default-d | enp6rq72rndgr******** | ru-central1-d | [172.16.0.0/20] | | e2lkj9qwe762******** | default-b | enp6rq72rndgr******** | ru-central1-b | [10.10.0.0/16] | | e9b0ph42bn96******** | a-2 | enp6rq72rndgr******** | ru-central1-a | [172.16.32.0/20] | | e9b9v22r88io******** | default-a | enp6rq72rndgr******** | ru-central1-a | [172.16.16.0/20] | +----------------------+-----------+-----------------------+---------------+------------------+If the required subnet is not on the list, create it.
-
View a description of the CLI command for adding a host:
yc managed-redis host add --help -
Run the add host command:
yc managed-redis host add \ --cluster-name=<cluster_name> \ --host zone-id=<availability_zone>,` `subnet-id=<subnet_ID>,` `assign-public-ip=<public_access>,` `replica-priority=<host_priority>,` `shard-name=<shard_name>Where:
--cluster-name: Yandex Managed Service for Valkey™ cluster name. You can get it with the list of clusters in a folder.--host: Host settings:zone-id: Availability zone.subnet-id: Subnet ID. Specify it if the selected availability zone has two or more subnets.assign-public-ip: Internet access to the host via a public IP address,trueorfalse.replica-priority: Host priority for assignment as a master if the primary master fails. It is only available for non-sharded clusters.shard-name: Name of the shard to create the host in if the cluster is sharded.
To create a host:
-
Open the current Terraform configuration file describing your infrastructure.
For more information about creating this file, see this guide.
-
Add a
hostsection to the Yandex Managed Service for Valkey™ cluster description: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_ipis public access to the host,trueorfalse. -
Validate your configuration.
-
In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.
-
Run this command:
terraform validateTerraform will show any errors found in your configuration files.
-
-
Confirm resource changes.
-
Run this command to view the planned changes:
terraform planIf you described the configuration correctly, the terminal will display a list of the resources to update and their parameters. This is a verification step that does not apply changes to your resources.
-
If everything looks correct, apply the changes:
-
Run this command:
terraform apply -
Confirm updating the resources.
-
Wait for the operation to complete.
-
-
For more information, see this Terraform provider guide.
Time limits
A Terraform provider sets the timeout for Yandex Managed Service for Valkey™ cluster operations:
- Creating a cluster, including by restoring one from a backup: 15 minutes.
- Editing a cluster: 60 minutes.
- Deleting a cluster: 15 minutes.
Operations exceeding the set timeout are interrupted.
How do I change these limits?
Add the timeouts block to the cluster description, for example:
resource "yandex_mdb_redis_cluster" "<cluster_name>" {
...
timeouts {
create = "1h30m" # 1 hour 30 minutes
update = "2h" # 2 hours
delete = "30m" # 30 minutes
}
}
-
Get an IAM token for API authentication and place it in an environment variable:
export IAM_TOKEN="<IAM_token>" -
Use the Cluster.AddHosts 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>/hosts:batchCreate' \ --data '{ "hostSpecs": [ { "zoneId": "<availability_zone>", "subnetId": "<subnet_ID>", "shardName": "<shard_name>", "replicaPriority": "<host_priority>", "assignPublicIp": <allow_public_access_to_host> } ] }'Where
hostSpecssets the host parameters:zoneId: Availability zone.subnetId: Subnet ID. Specify it if the selected availability zone has two or more subnets.shardName: Shard name for the host. Only used if cluster sharding is enabled.replicaPriority: Host priority for assignment as a master if the primary master fails.assignPublicIp: Internet access to the host via a public IP address,trueorfalse. Public access is only a possibility if the cluster has TLS support enabled.
You can get the cluster ID from the folder’s cluster list.
-
Check the server response to make sure your request was successful.
-
Get an IAM token for API authentication and place it in an environment variable:
export IAM_TOKEN="<IAM_token>" -
Clone the cloudapi
repository:cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapiBelow, we assume the repository contents are stored in the
~/cloudapi/directory. -
Use the ClusterService.AddHosts 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>", "host_specs": [ { "zone_id": "<availability_zone>", "subnet_id": "<subnet_ID>", "shard_name": "<shard_name>", "replica_priority": "<host_priority>", "assign_public_ip": <allow_public_access_to_host> } ] }' \ mdb.api.cloud.yandex.net:443 \ yandex.cloud.mdb.redis.v1.ClusterService.AddHostsWhere
host_specsrepresents the host parameters:zone_id: Availability zone.subnet_id: Subnet ID. Specify it if the selected availability zone has two or more subnets.shard_name: Shard name for the host. Only used if cluster sharding is enabled.replica_priority: Host priority for assignment as a master if the primary master fails.assign_public_ip: Internet access to the host via a public IP address,trueorfalse. Public access is only a possibility if the cluster has TLS support enabled.
You can get the cluster ID from the folder’s cluster list.
-
Check the server response to make sure your request was successful.
Warning
If you cannot connect to the host you added, check that the cluster security group is configured correctly for the host subnet.
Updating a host
Note
Access to hosts from the Internet via public IP addresses is possible only if the cluster has been created with TLS support enabled.
To change the parameters of a cluster host:
-
Navigate to the folder dashboard
and select Yandex Managed Service for Valkey™. -
Click the cluster name and select the Hosts tab.
-
Click
next to the host in question and select Edit. -
Set new settings for the host:
- Enable Public access to make the host accessible from outside Yandex Cloud, if required.
- Specify host priority for assignment as a master.
-
Click Save.
If you do not have the Yandex Cloud CLI installed yet, install and initialize it.
By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id parameter.
To change the host parameters, run this command:
yc managed-redis host update <host_name> \
--cluster-name=<cluster_name> \
--assign-public-ip=<public_access> \
--replica-priority=<host_priority>
Where --assign-public-ip is public access to the host, true or false.
You can get the host name with the list of cluster hosts, and the cluster name, with the list of clusters in the folder.
To change the parameters of a cluster host:
-
Open the current Terraform configuration file describing your infrastructure.
For more information about creating this file, see this guide.
-
In the Yandex Managed Service for Valkey™ cluster description, change the attributes of the
hostblock corresponding to the host you are updating.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_ipis public access to the host,trueorfalse. -
Validate your configuration.
-
In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.
-
Run this command:
terraform validateTerraform will show any errors found in your configuration files.
-
-
Confirm resource changes.
-
Run this command to view the planned changes:
terraform planIf you described the configuration correctly, the terminal will display a list of the resources to update and their parameters. This is a verification step that does not apply changes to your resources.
-
If everything looks correct, apply the changes:
-
Run this command:
terraform apply -
Confirm updating the resources.
-
Wait for the operation to complete.
-
-
For more information, see this Terraform provider guide.
-
Get an IAM token for API authentication and place it in an environment variable:
export IAM_TOKEN="<IAM_token>" -
Use the Cluster.UpdateHosts method and send the following request, e.g., via cURL
:Warning
The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the
updateMaskparameter as a single comma-separated string.curl \ --request POST \ --header "Authorization: Bearer $IAM_TOKEN" \ --header "Content-Type: application/json" \ --url 'https://mdb.api.cloud.yandex.net/managed-redis/v1/clusters/<cluster_ID>/hosts:batchUpdate' \ --data '{ "updateHostSpecs": [ { "hostName": "<host_name>", "replicaPriority": "<host_priority>", "assignPublicIp": <public_access_to_cluster_host>, "updateMask": "replicaPriority,assignPublicIp" } ] }'Where
updateHostSpecsrepresents the host parameters:hostName: Name of the host you need to update. To find out the name, get a list of hosts in the cluster.replicaPriority: Host priority for assignment as a master if the primary master fails.assignPublicIp: Internet access to the host via a public IP address,trueorfalse. Public access is only a possibility if the cluster has TLS support enabled.updateMask: Comma-separated list of settings you want to update.
You can request the cluster ID with the list of clusters in the folder.
-
Check the server response to make sure your request was successful.
-
Get an IAM token for API authentication and place it in an environment variable:
export IAM_TOKEN="<IAM_token>" -
Clone the cloudapi
repository:cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapiBelow, we assume the repository contents are stored in the
~/cloudapi/directory. -
Use the ClusterService.UpdateHosts call and send the following request, e.g., via gRPCurl
:Warning
The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the
update_maskparameter as an array ofpaths[]strings.Format for listing settings
"update_mask": { "paths": [ "<setting_1>", "<setting_2>", ... "<setting_N>" ] }grpcurl \ -format json \ -import-path ~/cloudapi/ \ -import-path ~/cloudapi/third_party/googleapis/ \ -proto ~/cloudapi/yandex/cloud/mdb/redis/v1/cluster_service.proto \ -rpc-header "Authorization: Bearer $IAM_TOKEN" \ -d '{ "cluster_id": "<cluster_ID>", "update_host_specs": [ { "host_name": "<host_name>", "replica_priority": "<host_priority>", "assign_public_ip": <public_access_to_cluster_host>, "update_mask": { "paths": ["replica_priority", "assign_public_ip"] } } ] }' \ mdb.api.cloud.yandex.net:443 \ yandex.cloud.mdb.redis.v1.ClusterService.UpdateHostsWhere
update_host_specsrepresents the host parameters:host_name: Name of the host you need to update. To find out the name, get a list of hosts in the cluster.replica_priority: Host priority for assignment as a master if the primary master fails.assign_public_ip: Internet access to the host via a public IP address,trueorfalse. Public access is only a possibility if the cluster has TLS support enabled.update_mask: List of settings you want to update as an array ofpaths[]strings.
You can request the cluster ID with the list of clusters in the folder.
-
Check the server response to make sure your request was successful.
Warning
If you cannot connect to the host you added, check that the cluster security group is configured correctly for the host subnet.
Deleting a host
You can remove a host from a Valkey™ cluster if it is not the only host in it. To replace a single host, first create a new host and then remove the old one.
If the host is the master at the time of deletion, Yandex Managed Service for Valkey™ will automatically assign another replica as the master.
You cannot remove a host if the number of hosts in a cluster or cluster shard is equal to the minimum value. For more information, see Quotas and limits.
To delete a host from a cluster:
- Navigate to the folder dashboard
and select Yandex Managed Service for Valkey™. - Click the cluster name and select the Hosts tab.
- In the cluster row, click
and select Delete. - In the window that opens, check Delete host and click Confirm.
If you do not have the Yandex Cloud CLI installed yet, install and initialize it.
By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id parameter.
To delete a host from the cluster, run this command:
yc managed-redis host delete <host_name> \
--cluster-name=<cluster_name>
You can get the host name with the list of cluster hosts, and the cluster name, with the list of clusters in the folder.
To delete a host from a cluster:
-
Open the current Terraform configuration file describing your infrastructure.
For more information about creating this file, see this guide.
-
Delete the
hostblock from the Yandex Managed Service for Valkey™ cluster description. -
Validate your configuration.
-
In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.
-
Run this command:
terraform validateTerraform will show any errors found in your configuration files.
-
-
Type
yesand press Enter.-
Run this command to view the planned changes:
terraform planIf you described the configuration correctly, the terminal will display a list of the resources to update and their parameters. This is a verification step that does not apply changes to your resources.
-
If everything looks correct, apply the changes:
-
Run this command:
terraform apply -
Confirm updating the resources.
-
Wait for the operation to complete.
-
-
For more information, see this Terraform provider guide.
Time limits
A Terraform provider sets the timeout for Yandex Managed Service for Valkey™ cluster operations:
- Creating a cluster, including by restoring one from a backup: 15 minutes.
- Editing a cluster: 60 minutes.
- Deleting a cluster: 15 minutes.
Operations exceeding the set timeout are interrupted.
How do I change these limits?
Add the timeouts block to the cluster description, for example:
resource "yandex_mdb_redis_cluster" "<cluster_name>" {
...
timeouts {
create = "1h30m" # 1 hour 30 minutes
update = "2h" # 2 hours
delete = "30m" # 30 minutes
}
}
-
Get an IAM token for API authentication and put it into the environment variable:
export IAM_TOKEN="<IAM_token>" -
Use the Cluster.DeleteHosts 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>/hosts:batchDelete' \ --data '{ "hostNames": [ "<host_name>" ] }'Where
hostNamesis the name of the host to delete. To find out the name, get a list of hosts in the cluster.You can get the cluster ID with a list of clusters in the folder.
-
View the server response to make sure the request was successful.
-
Get an IAM token for API authentication and put it into the environment variable:
export IAM_TOKEN="<IAM_token>" -
Clone the cloudapi
repository:cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapiBelow, we assume the repository contents are stored in the
~/cloudapi/directory. -
Use the ClusterService.DeleteHosts 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>", "host_names": [ "<host_name>" ] }' \ mdb.api.cloud.yandex.net:443 \ yandex.cloud.mdb.redis.v1.ClusterService.DeleteHostsWhere
host_namesis the name of the host to delete. To find out the name, get a list of hosts in the cluster.You can get the cluster ID with a list of clusters in the folder.
-
View the server response to make sure the request was successful.