# Problem with restore with --replset-remapping

**URL:** <https://forums.percona.com/t/problem-with-restore-with-replset-remapping/18600>\
**Category:** Percona Backup for MongoDB\
**Created:** [November 16, 2022, 1:56pm UTC](https://forums.percona.com/t/problem-with-restore-with-replset-remapping/18600 "2022-11-16T13:56:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Piotr\_Krogulec](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/piotr_krogulec/32/8358_2.png) [@Piotr\_Krogulec](https://forums.percona.com/u/Piotr_Krogulec)\
**Post date:** [November 16, 2022, 1:56pm UTC](https://forums.percona.com/t/problem-with-restore-with-replset-remapping/18600/1 "2022-11-16T13:56:38Z")

</div>

Hl, I’m testing new PBM version (2.0.2) to prepare upgrade from 1.8.1 and I have problem with restoring to new cluster. My procedure:

1. Prepare new cluster
2. Change prefix for s3 (minio) pointing to current cluster from which we want to restore (with force reconfig)
3. Call pbm restore with --replset-remapping

Restore starts but finishes with error:

```auto
mongorestore: restore mongo dump (successes: 0 / fails: 0): I/O failure reading beginning of archive: compose: metadata: read: download 'my-bucket/2022-11-15T23:13:25Z/my-target-cluster/metadata.json': NoSuchKey: The specified key does not exist.
	status code: 404

```

- pbm list and status with --replset-remapping work as expected
- source backup exists in S3: **my-bucket/my-source-cluster/2022-11-15T23:13:25Z/my-source-cluster-rs0/**
- restore in place works as expected
- above procedure works with pbm 1.8.1
- restoring backup made with pbm 1.8.1 also worked for 2.0.2

Do you have some idea how to solve this problem?

---

<div class="post-metadata">

**Author:** ![Andrey\_Agafonov](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/andrey_agafonov/32/8652_2.png) [@Andrey\_Agafonov](https://forums.percona.com/u/Andrey_Agafonov)\
**Post date:** [December 14, 2022, 7:15pm UTC](https://forums.percona.com/t/problem-with-restore-with-replset-remapping/18600/2 "2022-12-14T19:15:09Z")

</div>

Hi!  
I have the same problem.  
I have

- sharded cluster cluster\_1 as source.
- sharded cluster\_2 as dest cluster.
- configured PBM on dest cluster for restore.  
pbm list, status - ok.

1. Call pbm restore with --replset-remapping return error:

```auto
2022-12-14T19:03:24Z E [replicaset_name/mdb-name.domain:27017] [restore/2022-12-14T19:02:24.375285868Z] mongorestore: restore mongo dump (successes: 0 / fails: 0): I/O failure reading beginning of archive: compose: metadata: read: download 'bucket_name/2022-12-14T00:00:20Z/replicaset_name/metadata.json': NoSuchKey: The specified key does not exist.
	status code: 404, request id: 4H8<------>G7, host id: Rz6<-------->sreA98=

```

Source bucket, and path - exist.  
Piotr\_Krogulec Did you solve the problem?

---

<div class="post-metadata">

**Author:** ![Piotr\_Krogulec](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/piotr_krogulec/32/8358_2.png) [@Piotr\_Krogulec](https://forums.percona.com/u/Piotr_Krogulec)\
**Post date:** [December 20, 2022, 8:09am UTC](https://forums.percona.com/t/problem-with-restore-with-replset-remapping/18600/3 "2022-12-20T08:09:41Z")

</div>

Hi, there is a PR [PBM-1003 Fix ability to restore with remapping replicaset names by ziollek · Pull Request #751 · percona/percona-backup-mongodb · GitHub](https://github.com/percona/percona-backup-mongodb/pull/751) made by my colleague from team and it’s accepted. Only question is, when it will be released.

---

<div class="post-metadata">

**Author:** ![Andrey\_Agafonov](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/andrey_agafonov/32/8652_2.png) [@Andrey\_Agafonov](https://forums.percona.com/u/Andrey_Agafonov)\
**Post date:** [December 20, 2022, 11:15am UTC](https://forums.percona.com/t/problem-with-restore-with-replset-remapping/18600/4 "2022-12-20T11:15:32Z")

</div>

Unfortunately, I did not see a specific problem. But suddenly it will be useful.

Looked for the problem on my end.

If I do remapping and backups are stored in S3, then the pbm agent tries to download a non-existent backup.

For example:

Source Cluster:

cluster\_1

/shard\_sorce\_1

/shard\_sorce\_2

dest cluster

cluster\_2

/shard\_dest\_1

/shard\_dest\_2

On s3 backup

2022-12-17TIME

/shard\_sorce\_1

/shard\_sorce\_2

I’am try run

```bash

pbm restore 2022-12-17TIME --replset-remapping="shard_dest_1=shard_sorce_1,shard_dest_2=shard_sorce_2"

```

Agent is trying to download 2022-12-17TIME/shard\_dest\_1 and 2022-12-17TIME/shard\_dest\_2. But there is no such path. so we get 404.

as a check, created copies of backups of replicas

2022-12-17TIM:

/shard\_sorce\_1

/shard\_dest\_1 (copy from shard\_sorce\_1)

/shard\_sorce\_2

/shard\_dest\_2 (copy from shard\_sorce\_2)

In this configuration, the restore is works.  
sorry for my english 🙂
