From 5dadc93c3a48ff86ebb7592e9ad94edf5cde248a Mon Sep 17 00:00:00 2001 From: Anastasia Alexadrova Date: Thu, 5 Jun 2025 19:24:56 +0200 Subject: [PATCH] K8SPSMDB-1386 Improved restore doc Added a subsection explaining restores with prefixes define for a bucket --- docs/backups-restore.md | 106 +++++++++++++++++++++++++++------------- 1 file changed, 71 insertions(+), 35 deletions(-) diff --git a/docs/backups-restore.md b/docs/backups-restore.md index 6e9ededc..5710ca7f 100644 --- a/docs/backups-restore.md +++ b/docs/backups-restore.md @@ -1,34 +1,40 @@ # Restore the cluster from a previously saved backup -The backup is normally restored on the Kubernetes cluster where it was made, but [restoring it on a different Kubernetes-based environment with the installed Operator is also possible](backups-restore-to-new-cluster.md). +This document describes how to restore from a backup on the same the Kubernetes cluster where it was made. -Following things are needed to restore a previously saved backup: +You can also [restore a backup on a different Kubernetes-based environment with the installed Operator](backups-restore-to-new-cluster.md) as part of the disaster recovery strategy or when you configure [multi-cluster deployment with cross-site replication](replication.md). + +## Restore types + +You can make the following restores: + +* [Restore to a specific point in time](#make-a-point-in-time-recovery). A precondition for this restore is to [enable saving oplog operations](backups-pitr.md) +* [Restore only a backup snapshot](#restore-without-point-in-time-recovery) +* [Selective restore from a logical backup](#selective-restore) + +For either type of a restore you need to create a Restore object using the [`deploy/backup/restore.yaml` :octicons-link-external-16:]( manifest. + +## Before you begin * Make sure that the cluster is running. -* Find out correct names for the **backup** and the **cluster**. Available backups can be listed with the following command: +* Get backup information. List the backups using this command: ``` {.bash data-prompt="$" } $ kubectl get psmdb-backup ``` - And the following command will list available clusters: +* Get cluster information. List available clusters using this command: ``` {.bash data-prompt="$" } $ kubectl get psmdb ``` -!!! note - - If you have [configured storing operations logs for point-in-time recovery](backups-pitr.md), you will have possibility to roll back the cluster to a specific date and time. Otherwise, restoring backups without point-in-time recovery is the only option. +## Restore without point-in-time recovery -When the correct names for the backup and the cluster are known, backup restoration can be done in the following way. +1. Modify the [deploy/backup/restore.yaml :octicons-link-external-16:](https://github.com/percona/percona-server-mongodb-operator/blob/main/deploy/backup/restore.yaml) manifest and set the following keys: -## Without point-in-time recovery - -1. Set appropriate keys in the [deploy/backup/restore.yaml :octicons-link-external-16:](https://github.com/percona/percona-server-mongodb-operator/blob/main/deploy/backup/restore.yaml) file. - - * set `spec.clusterName` key to the name of the target cluster to restore the backup on, - * set `spec.backupName` key to the name of your backup, + * set `spec.clusterName` key to the name of your cluster. When restoring to the same cluster where the backup was created, the cluster name will be identical in both the Backup and Restore objects. + * set `spec.backupName` key to the name of your backup. ```yaml apiVersion: psmdb.percona.com/v1 @@ -40,7 +46,7 @@ When the correct names for the backup and the cluster are known, backup restorat backupName: backup1 ``` -2. After that, the actual restoration process can be started as follows: +2. Start the restore by creating the Restore object. Use the following command: ``` {.bash data-prompt="$" } $ kubectl apply -f deploy/backup/restore.yaml @@ -48,7 +54,7 @@ When the correct names for the backup and the cluster are known, backup restorat !!! note - Storing backup settings in a separate file can be replaced by passing its content to the `kubectl apply` command as follows: + Instead of storing restore settings in a separate file, you can pass them directly to the `kubectl apply` command as follows: ```bash $ cat < Full backup objects available with the `kubectl get psmdb-backup` command have a "Latest restorable time" information field handy when selecting a backup to restore. You can easily query the backup for this information as follows: + When you run `kubectl get psmdb-backup`, each backup shows a "Latest restorable time" field. This helps you choose which backup to restore. To get just this time, use: ``` {.bash data-prompt="$" } $ kubectl get psmdb-backup -o jsonpath='{.status.latestRestorableTime}' ``` -2. Run the actual restoration process: +2. Start the restore by creating a Restore object: ``` {.bash data-prompt="$" } $ kubectl apply -f deploy/backup/restore.yaml @@ -104,9 +111,9 @@ When the correct names for the backup and the cluster are known, backup restorat !!! note - Storing backup settings in a separate file can be replaced by passing its content to the `kubectl apply` command as follows: + Instead of storing restore settings in a separate file, you can pass them directly to the `kubectl apply` command as follows: - ``` {.bash data-prompt="$" } + ```bash $ cat <