0

Both of my secondary nodes are way behind the primary node. Both node1 and node3 are recovery state now.

In this situation I have tried many times following options

  1. Delete the data directory on 3rd node and start the daemon then the node goes for startup2 state for more than 12 hours and then becomes recovery state forever.
  2. I also tried locking primary db.fsyncLock() and then copy then copy over the data from primary node to node3 but when I started the daemon I get 51 code (though I delete mongod.pid and mongod.lock file on node3)

On d2node which is primary:

mongo7955:PRIMARY> rs.printSlaveReplicationInfo();
source: d1node:7955
        syncedTo: Tue Apr 20 2021 06:08:00 GMT+0000 (UTC)
        814437 secs (226.23 hrs) behind the primary
source: d3node:7955
        syncedTo: Thu Jan 01 1970 00:00:00 GMT+0000 (UTC)
        1619713317 secs (449920.37 hrs) behind the primary
mongo7955:PRIMARY>

what's the best way I can sync other 2 nodes ?

9
  • 1
    Maybe rs.remove("d3node") and rs.remove("d1node"). Then delete the data folder and add again from scratch. – Wernfried Domscheit Apr 29 at 19:21
  • 1
    Option 2 many work if you drop the local database, see Restore a Replica Set from MongoDB Backups – Wernfried Domscheit Apr 29 at 19:23
  • Yes, I do have enough space on disk. – Bharath Achar Apr 30 at 3:41
  • 1
    If you remove d3node and d1node then you have a single-member replica set. One member in a one-member replica set becomes the PRIMARY. Of course this contradicts the replication term - but you are in a temporary restore condition. – Wernfried Domscheit Apr 30 at 6:56
  • 1
    What mongod.log says on those nodes (d1node, d3node), what prevents replication? You may need to change logLevel higher. – JJussi May 1 at 6:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.