How to restore a backup in case of fully loose of data?

I have a question about how to restore a backup in case I need to restore it in a complete new environment. So imagine my original MongoDB replicaset is completely crashed and can no longer be used. Since Percona Backup is using the admin db for storing the PBM Control Collections they would also be lost. How can I start in a complete new environment, with restoring from an environment that is no longer accessible. So I would have only access to the backup-storage. Thanks in advance!

1 Like

Hi, welcome to the forum. You may refer to Restore a Replica Set to a New Environment with Percona Backup for MongoDB - Percona Database Performance Blog for instructions.

1 Like

Thanks for the quick answer. This is article is answering kost of my questions. But to summarize it, to restore it into a new environment I need to create a new replicaset by hand and add the pbmuser with a script. So will the full restore then overwrite the admin db or not? If not, I would have to create all users from the original admin db.

1 Like

PBM should restore the users for you so no need to create them yourself

1 Like

Thanks, sounds great!

1 Like

I just followed your instructions to test it, but the users from the original admin-db were not restored. I also couldn’t see that collection in the logs that you posted in your article. Is it a bug or by intention?

I just wanted to mention that I restored from a logical backup

1 Like

on which db you created users? is that in admin? also which PBM version are you running?

1 Like
Version:   2.0.2
Platform:  linux/amd64
GitCommit: 3ec38a5fc6706515fb1be72b015972af1500aa17
GitBranch: release-2.0.2
BuildTime: 2022-10-24_12:16_UTC
GoVersion: go1.19

This is the version of the pbm binary

The users are created in the admin db. By the way, when I did the restore from a physical backup, all users were restored.

1 Like

This is strange as I tested the same version and the users collection is correctly backed up and restored.

Backup logs:

Nov 02 17:12:19 mongo0 pbm-agent[14553]: 2022-11-02T17:12:19.687+0000        writing admin.system.users to archive on stdout
Nov 02 17:12:19 mongo0 pbm-agent[14553]: 2022-11-02T17:12:19.689+0000        Mux open namespace admin.system.users
Nov 02 17:12:19 mongo0 pbm-agent[14553]: 2022-11-02T17:12:19.689+0000        counted 3 documents in admin.system.users
Nov 02 17:12:19 mongo0 pbm-agent[14553]: 2022-11-02T17:12:19.691+0000        done dumping admin.system.users (3 documents)
Nov 02 17:12:19 mongo0 pbm-agent[14553]: 2022-11-02T17:12:19.691+0000        Mux close namespace admin.system.users

Restore logs:

Nov 02 17:14:02 mongo0 pbm-agent[14553]: 2022-11-02T17:14:02.471+0000        found collection admin.system.users bson to restore to admin.system.users
Nov 02 17:14:02 mongo0 pbm-agent[14553]: 2022-11-02T17:14:02.471+0000        found collection metadata from admin.system.users to restore to admin.system.users
Nov 02 17:14:02 mongo0 pbm-agent[14553]: 2022-11-02T17:14:02.471+0000        adding intent for admin.system.users
1 Like

Thank you for your effort. I’ll test it tomorrow again.

1 Like