Hi Team,
Sorry if it’s a duplicate question.
We do have one primary and one secondary replication setup. I’m facing an issue that the secondary server is going into a recovery state frequently. Could you please help me to know the major and exact reason for the cause so that I can prevent the issue in the future?
I’ve stopped the mongod service on secondary and deleted the data and again restarted the service. Now the secondary state show as “STARTUP2” until the sync gets completed. Not sure what I’m missing. Even the last time when I followed the same process the secondary went into a Recovery state from “STARTUP2” once the sync got completed. The primary and secondary servers are having the same config. Please let me know if you require any more details.
Below is the error I could find in the mongod.log.
“ctx”:“ReplCoordExtern-0”,“msg”:“Recreating cursor for oplog fetcher due to error”,“attr”:{“lastOpTimeFetched”:{“ts”:{"$timestamp":{“t”:1657624021,“i”:126}},“t”:1},“attemptsRemaining”:1,“error”:“CappedPositionLost: Error while getting the next batch in the oplog fetcher :: caused by :: CollectionScan died due to position in capped collection being deleted. Last seen record id: RecordId(7119440959259017343)”}}