Single Database Backup/Restore - Sharded cluster [Discussion]

I Have two Percona Mongodb sharded clusters running version Mongodb 4.4 and 4.0.6 versions.
Currently I’m in the process of migrating Mongodb databases running as a standalone into Percona Sharded cluster using logical backup method.

What I want to achieve:

  • To be able to backup a single database using Mongodump [This database can be located in a standalone mongodb or in a Percona sharded cluster]
  • Restore it to Percona sharded cluster.

But, I am having issue when backing up a single database (Either running individually as a standalone or from other sharded clusters) and restore it into a sharded cluster.

Steps to reproduce:
Take a Backup using Mongodump from either a standalone mongodb or from a sharded cluster.
Restore it into a Percona sharded clusters running versions 4.4 and 4.0.6

Error:

2022-09-11T12:56:19.636+0000    Failed:: error restoring from archive '/tmp/collection.archive': connection() error occurred during connection handshake:  
auth error: sasl conversation error: unable to authenticate using mechanism "SCRAM-SHA-256": (KeyNotFound) Cache Reader No keys found for HMAC that is valid for time: { ts: 
Timestamp(1662900979, 20003) } with id: 0                                                                                                                                 2022-09-11T12:56:19.636+0000    305064 document(s) restored successfully. 0 document(s) failed to restore.

The user used here has

mechanisms: [    "SCRAM-SHA-1", "SCRAM-SHA-256" ]})

Note that this issue happens usually only with big databases. But for small dbs mongodump and mongorestore works fine in sharded cluster.

2 Likes