Skip to content

Commit 5647f04

Browse files
added selective restore section
1 parent ae84767 commit 5647f04

File tree

2 files changed

+47
-9
lines changed

2 files changed

+47
-9
lines changed

docs/usage/backup-selective.md

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ During the backup process, Percona Backup for MongoDB stores data in the new mul
2626

2727
Multi-format is the default data format for both full and selective backups since it allows selective restore. Note, however, that you can make only full restores from backups made with earlier versions of Percona Backup for MongoDB.
2828

29-
## Backup with users and roles
29+
## Selective backup with users and roles
3030

3131
### Overview
3232

33-
Percona Backup for MongoDB allows you to perform selective backups and restores of databases and collections. Additionally, you can choose to include **users and roles defined** in the database in your selective backup, ensuring that access control is restored along with the data.
33+
Percona Backup for MongoDB allows you to perform selective backups of databases and collections. Additionally, you can choose to include **users and roles defined** in the database in your selective backup, ensuring that access control is restored along with the data.
3434

3535
To back up a specific namespace and include users and roles, run the following command:
3636

@@ -40,11 +40,11 @@ pbm backup --ns="mydb.*" --with-users-and-roles
4040

4141
where:
4242

43-
`--ns="mydb.*"` specifies the namespace (all collections in mydb).
43+
`--ns="mydb.*"` specifies the namespace (all collections in mydb).
4444

45-
`--with-users-and-roles` ensures that users and roles defined in `mydb` are included in the backup.
45+
`--with-users-and-roles` ensures that users and roles defined in `mydb` are included in the backup.
4646

47-
The `--with-users-and-roles` flag ensures that any custom users and roles defined within the target database are included, maintaining the integrity of your access control list (ACL) without needing a full cluster restore.
47+
`--with-users-and-roles` ensures that any custom users and roles defined within the target database are included, maintaining the integrity of your access control list (ACL) without needing a full cluster restore.
4848

4949

5050
??? info "What happens under the hood?"
@@ -66,10 +66,7 @@ This command backs up all collections in the **invoices** database along with it
6666
=== "Partial Migration of a database"
6767
As applications scale, you may need to migrate a specific database from a shared cluster to dedicated hardware. Using `--with-users-and-roles` ensures that the destination cluster immediately inherits the application-specific users and custom roles, preventing errors post-migration.
6868

69-
=== "Roll back access control changes"
70-
A recent modification to custom roles in `mydb` introduced permission failures. Applications that rely on those roles can no longer perform required operations.
71-
72-
To ensure full recovery, you need to restore not just the data but also the users and roles tied to the database’s access-control.
69+
7370

7471
=== "Staging environment"
7572
To reproduce production issues or validate security patches, you need a staging environment that mirrors production exactly.

docs/usage/restore-selective.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,47 @@ To restore a [custom database with users and roles](../features/selective-backup
3232
pbm restore <backup_name> --ns <database.*> --with-users-and-roles
3333
```
3434

35+
### Selective restore with users and roles
36+
37+
#### Overview
38+
39+
Percona Backup for MongoDB allows you to perform selective restore of databases and collections. Additionally, you can choose to include **users and roles defined** in the database in your selective backup, ensuring that access control is restored along with the data.
40+
41+
To restore a specific namespace and include users and roles, run the following command:
42+
43+
```sh
44+
pbm restore --ns="mydb.*" --with-users-and-roles <selective-backup-id>
45+
```
46+
47+
where:
48+
49+
`--ns="mydb.*"` → Restores only the collections belonging to mydb.
50+
51+
`--with-users-and-roles` → Restores the database-defined users and roles alongside the data.
52+
53+
`<selective-backup-id>` → The identifier of the backup to restore from (as shown in Percona Backup for MongoDB backup listings and logs).
54+
55+
??? info "What happens under the hood?"
56+
- Percona Backup for MongoDB restores the selected collections within `mydb` from the specified backup.
57+
- Percona Backup for MongoDB restores roles where the db field matches `mydb`.
58+
- Percona Backup for MongoDB restores users where the db field matches `mydb`, including their role assignments within `mydb`.
59+
60+
**Example**
61+
62+
```sh
63+
pbm restore --ns="invoices.*" --with-users-and-roles backup20260110_123456
64+
```
65+
66+
#### Use cases
67+
68+
=== "Partial restore after data loss"
69+
A service using `mydb` experienced accidental deletes or corruption, while other databases in the cluster remain unaffected. Selective restore limits recovery to only the required database.
70+
71+
=== "Roll back access control changes"
72+
A recent modification to custom roles in `mydb` introduced permission failures. Applications that rely on those roles can no longer perform required operations.
73+
74+
To ensure full recovery, you need to restore not just the data but also the users and roles tied to the database’s access-control.
75+
3576
### Restore a collection under a different name
3677

3778
You can restore a specific collection under a different name alongside the current collection. This is useful when you troubleshoot database issues and need to compare the data in both collections to identify the root of the issue.

0 commit comments

Comments
 (0)