1

Once mongorestore is completed.

Most of the times one of the node will not be able to catch the primary after the restore is done on primary and that becomes too stale to replicate from Primary.

What is the possible cause for this ?

RS:PRIMARY> rs.printReplicationInfo()
configured oplog size:   4096MB
log length start to end: 18196secs (5.05hrs)
oplog first event time:  Sat Aug 14 2021 00:32:18 GMT+*****
oplog last event time:   Sat Aug 14 2021 05:35:34 GMT+*****
now:                     Sat Aug 14 2021 05:35:39 GMT+*****
RS:PRIMARY>

RS:RECOVERING> rs.printReplicationInfo()
configured oplog size:   4096MB
log length start to end: 679secs (0.19hrs)
oplog first event time:  Fri Aug 13 2021 23:38:21 GMT+*****
oplog last event time:   Fri Aug 13 2021 23:49:40 GMT+*****
now:                     Sat Aug 14 2021 05:27:25 GMT+*****
RS:RECOVERING> 

RS:SECONDARY> rs.printReplicationInfo()
configured oplog size:   4096MB
log length start to end: 17892secs (4.97hrs)
oplog first event time:  Sat Aug 14 2021 00:32:19 GMT+*****
oplog last event time:   Sat Aug 14 2021 05:30:31 GMT+*****
now:                     Sat Aug 14 2021 05:30:40 GMT+*****
RS:SECONDARY>
3
  • 1
    How long does the inital Sync take? Most likely more than 5 hours? In this case, increase the oplog size. Aug 14 at 18:29
  • are there any adverse effects on increasing oplog size ?
    – unknown
    Aug 15 at 8:32
  • Obviously you need more disk space. I am not aware of anything else. Aug 15 at 9:16
2

You must increase the size of your primary node's oppLog size. Here you can find how!

Problem is that there is not enough information stored "what happened" (changes to the collections) during that initial sync.

5
  • why would this happens only to one of the secondary and why that only secondary always fails to catch up primary and falls behind primary and goes out of sync. whereas the other doesn't fail catch primary with all oplogs.
    – unknown
    Aug 15 at 8:25
  • are there any adverse effects on increasing oplog size ?
    – unknown
    Aug 15 at 8:32
  • Why not always re-sync fail... There is only 6 min. difference between opLog size and time what (in that example) it took to resync. Sometimes re-sync takes more time than other times. Many some of the nodes do re-sync a bit faster than others. Only effect is disk usage...
    – JJussi
    Aug 16 at 10:38
  • there's any difference in disk usage on both the servers. I do have 80% free space on all 3 nodes.
    – unknown
    Aug 16 at 12:57
  • 1
    If you double current 4096MB to 8192MB you get 10 hours of oplog... If your disks are not tiny, you could change oplog to 40960MB what would be much better size.
    – JJussi
    Aug 17 at 14:37

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.