Managing backups in Yandex Managed Service for Valkey™
You can create backups and restore clusters from existing backups.
Yandex Managed Service for Valkey™ also creates automatic daily backups. You can set the backup start time:
Restoring clusters from backups
When you restore a cluster from a backup, you create a new cluster with the backup data. If the folder has insufficient resources to create such a cluster, you will not be able to restore from the backup. The average backup recovery speed is 10 MBps.
If you chose the local-ssd disk type when restoring the cluster from a backup, add at least two hosts per shard.
To restore an existing cluster from a backup:
- In the management console
, go to the folder to restore the cluster in. - Select Yandex Managed Service for Valkey™.
- Click the cluster name and open the Backups tab.
- In the line of the appropriate backup, click
and select Restore cluster. - Set up the new cluster. You can select a folder for the new cluster from the Folder list.
- Click Restore cluster.
To restore a previously deleted cluster from a backup:
- In the management console
, go to the folder to restore the cluster in. - Select Yandex Managed Service for Valkey™.
- In the left-hand panel, select
Backups. - Find the backup you need using the backup creation time and cluster ID. The ID column contains IDs formatted as
<cluster_ID>:<backup_ID>
. - In the line of the appropriate backup, click
and select Restore cluster. - Set up the new cluster. You can select a folder for the new cluster from the Folder list.
- Click Restore cluster.
Yandex Managed Service for Valkey™ will launch the operation to create a cluster from the backup.
If you do not have the Yandex Cloud command line interface yet, install and initialize 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 restore a cluster from a backup:
-
View a description of the CLI restore Valkey™ cluster command:
yc managed-redis cluster restore --help
-
Getting a list of available Valkey™ cluster backups:
yc managed-redis backup list
Result:
+--------------------------+---------------------+----------------------+---------------------+ | ID | CREATED AT | SOURCE CLUSTER ID | STARTED AT | +--------------------------+---------------------+----------------------+---------------------+ | c9qlk4v13uq7********:... | 2020-08-10 12:00:00 | c9qlk4v13uq7******** | 2020-08-10 11:55:17 | | ... | +--------------------------+---------------------+----------------------+---------------------+
-
Request creating a cluster from a backup:
yc managed-redis cluster restore \ --backup-id c9q287aqv5rf********:20181113T133617 \ --name mynewrd \ --environment=PRODUCTION \ --network-name default \ --host zone-id=ru-central1-a,subnet-id=b0rcctk2rvtr********,assign-public-ip=true,replica-priority=50 \ --password P@ssWord \ --disk-size 20
This results in a new Valkey™ cluster with the following characteristics:
- Name:
mynewrd
- Environment:
PRODUCTION
- Network:
default
- Host class:
hm1.nano
(one host); subnet:b0rcctk2rvtr********
; availability zone:ru-central1-a
; access: public; replica priority:50
. - Password:
P@ssWord
. - Network SSD storage (
network-ssd
): 20 GB
The password must be between 8 and 128 characters long. The password must meet the
[a-zA-Z0-9@=+?*.,!&#$^<>_-]*
regular expression. - Name:
-
Get an IAM token for API authentication and put it into the environment variable:
export IAM_TOKEN="<IAM_token>"
-
Use the Cluster.Restore 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:restore' \ --data '{ "backupId": "<backup_ID>", "name": "<cluster_name>", "environment": "<environment>", "configSpec": { "redis": { "password": "<user_password>" } }, "hostSpecs": [ { "zoneId": "<availability_zone>", "subnetId": "<subnet_ID>", "replicaPriority": "<host_priority>", "assignPublicIp": <public_access_to_cluster_host> }, { <similar_configuration_for_host_2> }, { ... }, { <similar_configuration_for_host_N> } ], "networkId": "<network_ID>", "tlsEnabled": <encrypted_TLS_connection_support> }'
Where:
-
backupId
: Backup ID. To find out the ID, get a list of folder backups. -
name
: Cluster name. -
environment
: Environment,PRESTABLE
orPRODUCTION
. -
configSpec.redis.password
: User password. -
hostSpecs
: Host parameters:zoneId
: Availability zone.subnetId
: Subnet ID. Specify if two or more subnets are created in the selected availability zone.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
orfalse
. You can enable public access only if thetlsEnabled
parameter is set totrue
.
-
networkId
: ID of the network the cluster will be in. -
tlsEnabled
: Support for encrypted TLS connections to the cluster,true
orfalse
.Warning
You can only enable connection encryption when creating a new cluster. You cannot disable encryption for a cluster that it is enabled for.
-
-
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/cloudapi
Below, we assume the repository contents are stored in the
~/cloudapi/
directory. -
Use the Cluster.Restore 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 '{ "backup_id": "<backup_ID>", "name": "<cluster_name>", "environment": "<environment>", "config_spec": { "redis": { "password": "<user_password>" } }, "host_specs": [ { "zone_id": "<availability_zone>", "subnet_id": "<subnet_ID>", "replica_priority": "<host_priority>", "assign_public_ip": <public_access_to_cluster_host> }, { <similar_configuration_for_host_2> }, { ... }, { <similar_configuration_for_host_N> } ], "network_id": "<network_ID>", "tls_enabled": <encrypted_TLS_connection_support> }' \ mdb.api.cloud.yandex.net:443 \ yandex.cloud.mdb.redis.v1.ClusterService.Restore
Where:
-
backup_id
: Backup ID. To find out the ID, get a list of folder backups. -
name
: Cluster name. -
environment
: Environment,PRESTABLE
orPRODUCTION
. -
config_spec.redis.password
: User password. -
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.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
orfalse
. You can enable public access only if thetlsEnabled
parameter is set totrue
.
-
network_id
: ID of the network the cluster will be in. -
tls_enabled
: Support for encrypted TLS connections to the cluster,true
orfalse
.Warning
You can only enable connection encryption when creating a new cluster. You cannot disable encryption for a cluster that it is enabled for.
-
-
View the server response to make sure the request was successful.
Creating a backup
- In the management console
, go to the folder to create a backup in. - Select Yandex Managed Service for Valkey™.
- Click the cluster name and open the Backups tab.
- Click Create backup.
The service will start creating a backup without an additional confirmation.
If you do not have the Yandex Cloud command line interface yet, install and initialize 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 create a cluster backup:
-
View a description of the CLI create Valkey™ backup command:
yc managed-redis cluster backup --help
-
Request the creation of a backup specifying the cluster name or ID:
yc managed-redis cluster backup my-rd-cluster
The cluster name and ID can be retrieved with the list of clusters.
-
Get an IAM token for API authentication and put it into the environment variable:
export IAM_TOKEN="<IAM_token>"
-
Use the Cluster.Backup 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>:backup'
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/cloudapi
Below, we assume the repository contents are stored in the
~/cloudapi/
directory. -
Use the ClusterService.Backup 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.Backup
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.
Warning
While you are creating your backup, the cluster performance might degrade.
Getting a list of backups
To get a list of cluster backups:
- In the management console
, go to the relevant folder. - Select Yandex Managed Service for Valkey™.
- Click the cluster name and open the Backups tab.
To get a list of all backups in a folder:
- In the management console
, go to the relevant folder. - Select Yandex Managed Service for Valkey™.
- In the left-hand panel, select
Backups.
If you do not have the Yandex Cloud command line interface yet, install and initialize 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 Valkey™ cluster backups available in the default folder, run the command:
yc managed-redis backup list
Result:
+--------------------------+---------------------+----------------------+---------------------+
| ID | CREATED AT | SOURCE CLUSTER ID | STARTED AT |
+--------------------------+---------------------+----------------------+---------------------+
| c9qlk4v13uq7********:... | 2020-08-10 12:00:00 | c9qlk4v13uq7******** | 2020-08-10 11:55:17 |
| c9qpm90p3pcg********:... | 2020-08-09 22:01:04 | c9qpm90p3pcg******** | 2020-08-09 21:30:00 |
+--------------------------+---------------------+----------------------+---------------------+
-
Get an IAM token for API authentication and put it into the environment variable:
export IAM_TOKEN="<IAM_token>"
-
To get a list of cluster backups:
-
Use the Cluster.ListBackups 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>/backups'
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.
-
-
To get a list of backups for all the clusters in a folder:
-
Use the Backup.List 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/backups' \ --url-query folderId=<folder_ID>
You can request the folder ID with the list of folders in the cloud.
-
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/cloudapi
Below, we assume the repository contents are stored in the
~/cloudapi/
directory. -
To get a list of cluster backups:
-
Use the ClusterService.ListBackups 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.ListBackups
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.
-
-
To get a list of backups for all the clusters in a folder:
-
Use the BackupService.List 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/backup_service.proto \ -rpc-header "Authorization: Bearer $IAM_TOKEN" \ -d '{ "folder_id": "<folder_ID>" }' \ mdb.api.cloud.yandex.net:443 \ yandex.cloud.mdb.redis.v1.BackupService.List
You can request the folder ID with the list of folders in the cloud.
-
View the server response to make sure the request was successful.
-
Getting information about backups
To get information about the backup of an existing cluster:
- In the management console
, go to the folder with the cluster to get backup information for. - Select Yandex Managed Service for Valkey™.
- Click the cluster name and open the Backups tab.
To get information about the backup of a previously deleted cluster:
- In the management console
, go to the folder the deleted cluster was in. - Select Yandex Managed Service for Valkey™.
- In the left-hand panel, select
Backups.
If you do not have the Yandex Cloud command line interface yet, install and initialize 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 Valkey™ cluster backup, run the command:
yc managed-redis backup get <backup_ID>
You can retrieve the backup ID with a list of backups.
-
Get an IAM token for API authentication and put it into the environment variable:
export IAM_TOKEN="<IAM_token>"
-
Use the Backup.Get 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/backups/<backup_ID>'
You can get the backup ID together with a list of backups.
-
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/cloudapi
Below, we assume the repository contents are stored in the
~/cloudapi/
directory. -
Use the BackupService.Get 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/backup_service.proto \ -rpc-header "Authorization: Bearer $IAM_TOKEN" \ -d '{ "backup_id": "<backup_ID>" }' \ mdb.api.cloud.yandex.net:443 \ yandex.cloud.mdb.redis.v1.BackupService.Get
You can get the backup ID together with a list of backups.
-
View the server response to make sure the request was successful.
Setting the backup start time
To set the backup start time, use the --backup-window-start
flag. Time is given in HH:MM:SS
format.
yc managed-redis cluster create \
--name <cluster_name> \
--environment <environment> \
--network-name <network_name> \
--host zone-id=<availability_zone>,subnet-id=<subnet_ID> \
--backup-window-start 10:25:00
Where --environment
is the environment: prestable
or production
.
To change the backup start time in an existing cluster, use the update
command:
yc managed-redis cluster update \
--name <cluster_name> \
--backup-window-start 11:25:00
-
Get an IAM token for API authentication and put it into the environment variable:
export IAM_TOKEN="<IAM_token>"
-
Use the Cluster.Update method and make a 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
updateMask
parameter as a single comma-separated string.curl \ --request PATCH \ --header "Authorization: Bearer $IAM_TOKEN" \ --header "Content-Type: application/json" \ --url 'https://mdb.api.cloud.yandex.net/managed-redis/v1/clusters/<cluster_ID>' \ --data '{ "updateMask": "configSpec.backupWindowStart", "configSpec": { "backupWindowStart": { "hours": "<hours>", "minutes": "<minutes>", "seconds": "<seconds>", "nanos": "<nanoseconds>" } } }'
Where:
-
updateMask
: List of parameters to update as a single string, separated by commas.In this case, only one parameter is provided.
-
configSpec.backupWindowStart
: Backup window settings.In this parameter, specify the backup start time:
hours
: Between0
and23
hours.minutes
: Between0
and59
minutes.seconds
: Between0
and59
seconds.nanos
: Between0
and999999999
nanoseconds.
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/cloudapi
Below, we assume the repository contents are stored in the
~/cloudapi/
directory. -
Use the ClusterService.Update call and make a 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_mask
parameter as an array ofpaths[]
strings.Format for listing settings
"update_mask": { "paths": [ "<setting_1>", "<setting_2>", ... "<setting_N>" ] }
grpcurl \ -format json \ -import-path ~/cloudapi/ \ -import-path ~/cloudapi/third_party/googleapis/ \ -proto ~/cloudapi/yandex/cloud/mdb/redis/v1/cluster_service.proto \ -rpc-header "Authorization: Bearer $IAM_TOKEN" \ -d '{ "cluster_id": "<cluster_ID>", "update_mask": { "paths": [ "config_spec.backup_window_start" ] }, "config_spec": { "backup_window_start": { "hours": "<hours>", "minutes": "<minutes>", "seconds": "<seconds>", "nanos": "<nanoseconds>" } } }' \ mdb.api.cloud.yandex.net:443 \ yandex.cloud.mdb.redis.v1.ClusterService.Update
Where:
-
update_mask
: List of parameters to update as an array ofpaths[]
strings.Only one parameter is provided in this case.
-
config_spec.backup_window_start
: Backup window settings.In this parameter, specify the backup start time:
hours
: Between0
and23
hours.minutes
: Between0
and59
minutes.seconds
: Between0
and59
seconds.nanos
: Between0
and999999999
nanoseconds.
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.