I have a replica set, I made a physical backup, then I stopped the database service and deleted the files in the data directory. I started the data again, initialized the replication set and pbm users, then configured the pbm parameter file and started the agent. But pbm list has no results. I know this information is stored under admin. So how should I restore the database?
Hi, you have to run pbm with --force-resync so that it reads your backups from the storage. After that you will be able to restore.
but, no --force-resync .
[root@mongodb01 backup]# pbm version
Version: 2.7.0
Platform: linux/amd64
GitCommit: 957ac501f939b1b784fcdcf61dcc5b9bf171e0b9
GitBranch: release-2.7.0
BuildTime: 2024-10-02_12:55_UTC
GoVersion: go1.22.8
[root@mongodb01 backup]# pbm restore --help
usage: pbm restore [<flags>] [<backup_name>]
Restore backup
Flags:
-h, --help Show context-sensitive help (also try --help-long and --help-man).
--mongodb-uri=MONGODB-URI MongoDB connection string (Default = PBM_MONGODB_URI environment variable)
-o, --out=text Output format <text>/<json>
--time=TIME Restore to the point-in-time. Set in format 2006-01-02T15:04:05
--base-snapshot=BASE-SNAPSHOT
Override setting: Name of older snapshot that PITR will be based on during restore.
--num-parallel-collections=NUM-PARALLEL-COLLECTIONS
Number of parallel collections
--ns=NS Namespaces to restore (e.g. "db1.*,db2.collection2"). If not set, restore all ("*.*")
--with-users-and-roles Includes users and roles for selected database (--ns flag)
-w, --wait Wait for the restore to finish.
--wait-time=WAIT-TIME Maximum wait time
-x, --external External restore.
-c, --config=CONFIG Mongod config for the source data. External backups only!
--ts=TS MongoDB cluster time to restore to. In <T,I> format (e.g. 1682093090,9). External backups only!
--replset-remapping=REPLSET-REMAPPING
re-map replset names for backups/oplog (e.g. to_name_1=from_name_1,to_name_2=from_name_2)
Args:
[<backup_name>] Backup name to restore
Try pbm config --force-resync