Mongorestore is not able to handle failover in replica set

I am using mongorestore, and having this setup:

there shards (1 primary and 2 secondary each)

Inserting data from mongos, using mongorestore, steps:

  1. One of my primary node get halt and other secondary got promoted to Primary in shard3
  2. Restore should auto detect new-primary and keep on inserting right?
  3. mongorestore got failed saying no master found.

I am getting new Primary and it is up for shard 3, failover worked well, but mongorestore unable to detect new primary.

Please ecplain the reson or we can do anything for this situation?

Hi @Aayushi_Mangal,

Which version of MongoDB are you using? I found an internal ticket that says this might have been resolved in the latest versions of MongoDB and mongorestore.

Can you please confirm you are still experiencing the same issue with

  • mongorestore 100.1.1
  • MongoDB 4.4.1

If that’s not the case, please just make sure that your cluster topology stays the same during your restore operations.

Also, please note that mongodump/mongorestore cannot be part of a backup strategy for 4.2+ sharded clusters that have sharded transactions in progress. More details here.

I hope this helps.


Hello @MaBeuLux88,

Thank you for explanation. I am using Mongo 4.2 version and same mongorestore version.
I am not very much sure how to use mongorestore 100.1.1.

We have one job that is using mongodump and restore, else we are not using this for backup.

Upgrading to the versions I mentioned would probably solve the issue from what I saw. Let me know if you can confirm this.

MongoDB Tools are now released independently from the main MongoDB releases. Their live cycles are now independent.