You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/backups-restore.md
+53-19Lines changed: 53 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,34 +1,40 @@
1
1
# Restore the cluster from a previously saved backup
2
2
3
-
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).
3
+
This document describes how to restore from a backup on the same the Kubernetes cluster where it was made.
4
4
5
-
Following things are needed to restore a previously saved backup:
5
+
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).
6
+
7
+
## Restore types
8
+
9
+
You can make the following restores:
10
+
11
+
*[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)
12
+
*[Restore only a backup snapshot](#restore-without-point-in-time-recovery)
13
+
*[Selective restore from a logical backup](#selective-restore)
14
+
15
+
For either type of a restore you need to create a Restore object using the [`deploy/backup/restore.yaml` :octicons-link-external-16:](<https://github.com/percona/percona-server-mongodb-operator/blob/main/deploy/backup/restore.yaml> manifest.
16
+
17
+
## Before you begin
6
18
7
19
* Make sure that the cluster is running.
8
-
*Find out correct names for the **backup** and the **cluster**. Available backups can be listed with the following command:
20
+
*Get backup information. List the backups using this command:
9
21
10
22
```{.bash data-prompt="$" }
11
23
$ kubectl get psmdb-backup
12
24
```
13
25
14
-
And the following commandwill list available clusters:
26
+
* Get cluster information. Run the following commandto list available clusters:
15
27
16
28
``` {.bash data-prompt="$" }
17
29
$ kubectl get psmdb
18
30
```
19
31
20
-
!!! note
32
+
## Restore without point-in-time recovery
21
33
22
-
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.
34
+
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 setthe following keys:
23
35
24
-
When the correct names forthe backup and the cluster are known, backup restoration can be donein the following way.
25
-
26
-
## Without point-in-time recovery
27
-
28
-
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.
29
-
30
-
*set`spec.clusterName` key to the name of the target cluster to restore the backup on,
31
-
*set`spec.backupName` key to the name of your backup,
36
+
*set`spec.clusterName` key to the name of the target cluster to restore the backup on. Since you restore on the same cluster where the backup was taken, the cluster name matches.
37
+
*set`spec.backupName` key to the name of your backup.
32
38
33
39
```yaml
34
40
apiVersion: psmdb.percona.com/v1
@@ -40,15 +46,15 @@ When the correct names for the backup and the cluster are known, backup restorat
40
46
backupName: backup1
41
47
```
42
48
43
-
2. After that, the actual restoration process can be started as follows:
49
+
2. Start the restore by creating the Restore object. Use the following command:
44
50
45
51
``` {.bash data-prompt="$" }
46
52
$ kubectl apply -f deploy/backup/restore.yaml
47
53
```
48
54
49
55
!!! note
50
56
51
-
Storing backup settings in a separate filecan be replaced by passing its content to the `kubectl apply`command as follows:
57
+
Instead of storing restore settings in a separate file, you can pass them directly to the `kubectl apply`command as follows:
52
58
53
59
```bash
54
60
$ cat <<EOF | kubectl apply -f-
@@ -62,13 +68,13 @@ When the correct names for the backup and the cluster are known, backup restorat
62
68
EOF
63
69
```
64
70
65
-
## With point-in-time recovery
71
+
## Make a point-in-time recovery
66
72
67
73
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.
68
74
69
75
*set`spec.clusterName` key to the name of the target cluster to restore the backup on
70
76
*set`spec.backupName` key to the name of your backup
71
-
*put additional restoration parameters to the `pitr` section:
77
+
*configure point-in-time recovery settings in the `pitr` section:
72
78
*`type` key can be equal to one of the following options
73
79
*`date` - roll back to specific date
74
80
*`latest` - recover to the latest possible transaction
@@ -125,6 +131,8 @@ When the correct names for the backup and the cluster are known, backup restorat
125
131
126
132
Starting with the version 1.18.0, you can restore a desired subset of data from a full logical backup. Selective logical backups are not yet supported.
127
133
134
+
Selective restores have a number of limitations. Learn more about the [current selective restore limitations :octicons-link-external-16:](https://docs.percona.com/percona-backup-mongodb/features/known-limitations.html#selective-backups-and-restores) in Percona Backup for MongoDB documentation.
135
+
128
136
Selective restores are controlled by the additional `selective` section in the `PerconaServerMongoDBRestore` Custom Resource. There you can specify a specific database or a collection that you wish to restore:
129
137
130
138
```yaml
@@ -140,5 +148,31 @@ The `selective.namespaces` field allows you to specify several "namespaces" (sub
140
148
141
149
Also, you can use `selective.withUsersAndRoles`set to `true` to restore a custom database with users and roles from a full backup.
142
150
143
-
Selective restores support only logical backups and have a number of other limitations. See the full list of [current selective restore limitations :octicons-link-external-16:](https://docs.percona.com/percona-backup-mongodb/features/known-limitations.html#selective-backups-and-restores) in Percona Backup for MongoDB documentation.
151
+
## Restore from a backup with a prefix in a bucket path
152
+
153
+
If you defined a prefix (a folder) in a bucket where you store backups, you must specify this prefix in the `spec.backupSource` subsection of the restore configuration.
154
+
155
+
To illustrate, let's say you defined a prefix `my-prefix` for your AWS s3 bucket `my-example-bucket`. You wish to restore a backup`2025-05-19T07:23:46Z`. The pull path to this backup is `"s3://my-example-bucket/my-prefix/2025-05-19T07:23:46Z"`. In this case, your restore configuration looks like this:
0 commit comments