Managing backups in Managed Service for OpenSearch
Managed Service for OpenSearch enables you to create index backups using both Yandex Cloud tools and the OpenSearch snapshot mechanism. For more information about snapshots, see the OpenSearch documentation
Creating backups with Yandex Cloud tools
You can create backups and restore clusters from existing backups.
Managed Service for OpenSearch also creates automatic hourly backups.
Getting a list of backups
You can get a list of backups created for the past 14 days.
To get a list of cluster backups:
- Go to the folder page and select Managed Service for OpenSearch.
- Click the name of the cluster you need and select the
Backups tab.
To get a list of all backups in a folder:
- Go to the folder page and select Managed Service for OpenSearch.
- 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 all backups in the folder, run this command:
yc managed-opensearch backup list
Result:
+----------------------+---------------------+-------------------+---------------------+
| ID | CREATED AT | SOURCE CLUSTER ID | STARTED AT |
+----------------------+---------------------+-------------------+---------------------+
| c9qlk4v13uq7******** | 2024-01-09 14:38:34 | c9qpm4i******** | 2024-01-09 14:38:28 |
| c9qpm90p3pcg******** | 2024-01-09 13:38:31 | c9qpm4i******** | 2024-01-09 13:38:28 |
+----------------------+---------------------+-------------------+---------------------+
If you want to limit the backup list displayed after running the command, include the --limit <number_of_records> flag in the command. For example, if the output of the
yc managed-opensearch backup listcommand takes up several screens, run the
yc managed-opensearch backup list --limit 5` command. In this case, the output will contain the list of five most recent backups.
To get a list of cluster backups, use the listBackups REST API method for the Cluster resource or the ClusterService/ListBackups gRPC API call and provide the cluster ID in the clusterId
parameter of your request.
You can get the cluster ID with a list of clusters in the folder.
To get a list of backups for all the Managed Service for OpenSearch clusters in the folder, use the list REST API method for the Backup resource or the BackupService/List gRPC API call and provide the folder ID in the folderId
parameter of your request.
Getting information about backups
To get information about the backup of an existing cluster:
- Go to the folder page and select Managed Service for OpenSearch.
- Click the name of the cluster you need and select the
Backups tab.
To get information about the backup of a previously deleted cluster:
- Go to the folder page and select Managed Service for OpenSearch.
- 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 the backup of a cluster:
-
Retrieve the backup ID with a list of all backups in the folder:
yc managed-opensearch backup list
You will see the ID in the
ID
column of the command output. -
Get information about the backup you need:
yc managed-opensearch backup get <backup_ID>
Command output example:
id: c9qlk4v13uq7******** folder_id: b1g86q4m5vej******** source_cluster_id: c9qpm4i******** started_at: "2024-01-09T10:38:28.683Z" created_at: "2024-01-09T10:38:31.685Z" indices: - .mdb-sli - .opendistro_security - .kibana_1 - .opendistro-job-scheduler-lock - .opensearch-observability - .opendistro-ism-config opensearch_version: 2.8.0 indices_total: "6"
To get information about a backup, use the get REST API method for the Backup resource or the BackupService/Get gRPC API call and provide the backup ID in the backupId
parameter of your request.
To find out the backup ID, retrieve a list of backups.
Creating a backup
- Go to the folder page and select Managed Service for OpenSearch.
- Click the name of the cluster you need and select 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 backup of cluster data, run this command:
yc managed-opensearch cluster backup <cluster_name_or_ID>
You can request the cluster name and ID with a list of clusters in the folder.
To create a backup, use the backup REST API method for the Cluster resource or the ClusterService/Backup gRPC API call and provide the cluster ID in the clusterId
parameter of your request.
You can get the cluster ID with a list of clusters in the folder.
Warning
While you are creating your backup, the cluster performance might degrade.
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.
When creating a new cluster, set all required parameters.
To restore an existing cluster from a backup:
- Go to the folder page and select Managed Service for OpenSearch.
- Click the name of the cluster you need and select the
Backups tab. - Click
for the backup you need and click Restore cluster. - Set up the new cluster.
- Click Restore cluster.
To restore a previously deleted cluster from a backup:
- Go to the folder page and select Managed Service for OpenSearch.
- 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_IP>
. - Click
for the backup you need and click Restore cluster. - Set up the new cluster.
- Click Restore cluster.
Managed Service for OpenSearch 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:
-
Retrieve the backup ID with a list of all backups in the folder:
yc managed-opensearch backup list
Result:
+----------------------+---------------------+-------------------+---------------------+ | ID | CREATED AT | SOURCE CLUSTER ID | STARTED AT | +----------------------+---------------------+-------------------+---------------------+ | c9qlk4v13uq7******** | 2024-01-09 14:38:34 | c9qpm4i******** | 2024-01-09 14:38:28 | | ... | +----------------------+---------------------+-------------------+---------------------+
You will see the backup ID in the
ID
column. TheCREATED AT
column shows the backup completion time inyyyy-mm-dd hh:mm:ss
format. -
Request the creation of a cluster from a backup:
yc managed-opensearch cluster restore --backup-id <backup_ID>
You can also run the command with the parameters you use when creating a cluster. For the description of such parameters, see Creating a cluster.
To restore an existing cluster from a backup, use the restore REST API method for the Cluster resource or the ClusterService/Restore gRPC API call and provide the following in the request:
- Backup ID in the
backupId
parameter. To find out the ID, get a list of cluster backups. - Name of the new cluster that will contain the data recovered from the backup, in the
name
parameter. It must be unique within the folder. - Cluster configuration in the
configSpec
parameter. - Network ID in the
networkId
parameter. - ID of the folder to host the cluster, in the
folderId
parameter.
Backups using snapshots
To work with snapshots, use the public API OpenSearch
Retrieving a snapshot list
-
Find the repository containing snapshot backups in the OpenSearch repository list:
GET https://admin:<password>@<ID_of_OpenSearch_host_with_DATA_role>.mdb.yandexcloud.net:9200/_snapshot/_all
If the required repository is not on the list, connect it.
-
Get a list of snapshots in the repository:
GET https://admin:<password>@<ID_of_OpenSearch_host_with_DATA_role>.mdb.yandexcloud.net:9200/_snapshot/<repository_name>/_all
Each snapshot is a single backup.
Creating a snapshot
-
In the OpenSearch repository list, find the repository where you want to create the snapshot:
GET https://admin:<password>@<ID_of_OpenSearch_host_with_DATA_role>.mdb.yandexcloud.net:9200/_snapshot/_all
If the required repository is not on the list, connect it.
-
Create a snapshot
of the required data or cluster in the selected repository:PUT https://admin:<password>@<ID_of_OpenSearch_host_with_DATA_role>.mdb.yandexcloud.net:9200/_snapshot/<repository_name>/<snapshot_name>
Restoring a cluster from a snapshot
Warning
When restoring a cluster from a snapshot, the OpenSearch version in the cluster must be equal to or higher than the OpenSearch version where the snapshot was taken.
-
Create a new OpenSearch cluster in the required configuration, but do not populate it with data.
When creating a cluster, select:
-
The number and class of hosts as well as the size and type of storage based on snapshot size and performance requirements.
-
The OpenSearch version used to make the snapshot or higher.
-
-
Close the open indexes using the OpenSearch API
:POST: https://admin:<password>@<ID_of_OpenSearch_host_with_DATA_role>.mdb.yandexcloud.net:9200/<index_name>/_close
To restore an entire cluster, close all open indexes. To restore individual indexes, close only those indexes.
-
Retrieve a list of backups and find the required snapshot.
-
Start restoring
an entire cluster or individual data indexes and streams from the required snapshot.