Schedule MongoDB Backup to S3 using Kubernetes CronJob

I am scheduling MongoDB backup to S3 and looks like I am facing this error whenever I try to run the job:

“Failed: error getting oplog start: error getting recent oplog entry: mongo: no documents in result”

I tried running the part of the script manually to troubleshoot more and looks like I get the same error. Below is a part of the script I am using to automate this:

echo “[$SCRIPT_NAME] Dumping all MongoDB databases to compressed archive…”
mongodump --oplog

also, this runs perfectly fine in prod but throws up this error in dev. both MongoDB is on the same version, what am I missing here?

Hi @Dolis_Sharma

Is the dev instance configured to be a replicaset? The oplog is only present on replicaset members.

@chris yes, I think that may be the issue here, dev is not configured to be a replica set. In that case, skipping oplog should work.