just a newbie in asking a question here. I hope I will not violate any rules with my question.
I created a Full backup (fsyncLock(), snapshot using "tar czvf", fysncUnlock()) and Incremental backup (mongodump -d local -c oplog.rs -q "(timestamp-range)") running every hour in contab (00 * * * *) by following this link below:
Also full backup using the native command mongodump (fsyncLock(), mongodump host dump/, fysncUnlock()) and the same strategy using the incremental backup I mentioned above.
I can restore the full backup with no problems, for native mongodump full backup, just create a new instance and restore. For the tar file snapshot, just untar, "mongod -d mongo.cnf", and force to reconfigure (rs.reconfig(cfg, {force: true})) the replica set since upon starting it will show "rs1:OTHER>". I manage to make it "PRIMARY>" after that even only running 1 instance first.
The problem is when restoring my hourly incremental backups, it shows this error upon running the command below:
> mongorestore --port 26017 -uroot --authenticationDatabase admin
> --oplogReplay 20191204-incre/2019-12-04-00\:00\:01/ Enter password:
>
> 2019-12-04T14:23:05.456+0800 preparing collections to restore from
> 2019-12-04T14:23:05.456+0800 replaying oplog
> 2019-12-04T14:23:05.609+0800 Failed: restore error: error handling
> transaction oplog entry: error replaying transaction: error extracting
> transaction ops: applyOps field: no such field
> 2019-12-04T14:23:05.609+0800 0 document(s) restored successfully. 0
> document(s) failed to restore.
When I renamed the file "oplog.rs.bson" to "oplog.bson" and run this command instead:
> mongorestore --port 26017 -uroot --authenticationDatabase admin
> --oplogReplay --oplogFile=20191204-incre/2019-12-04-01\:00\:01/local/oplog.bson 20191204-incre/2019-12-04-01\:00\:01/ Enter password:
>
> 2019-12-04T14:10:22.739+0800 preparing collections to restore from
> 2019-12-04T14:10:22.741+0800 restoring to existing collection
> local.oplog without dropping 2019-12-04T14:10:22.741+0800 restoring
> local.oplog from 20191204-incre/2019-12-04-01:00:01/local/oplog.bson
> 2019-12-04T14:10:22.791+0800 no indexes to restore
> 2019-12-04T14:10:22.791+0800 finished restoring local.oplog (1839
> documents, 0 failures) 2019-12-04T14:10:22.791+0800 replaying oplog
>
> 2019-12-04T14:10:22.915+0800 Failed: restore error: error handling
> transaction oplog entry: error replaying transaction: error extracting
> transaction ops: applyOps field: no such field
> 2019-12-04T14:10:22.915+0800 1839 document(s) restored successfully. 0
> document(s) failed to restore.
It successfully restored the oplogs, but under "local.oplog" instead of the "local.oplog.rs", and it really didn't replay the logs on their respective database.collection.
rs1:PRIMARY> use local
rs1:PRIMARY> show tables
oplog
oplog.rs
rs1:PRIMARY> db.oplog.count()
3679
Which part did I do it wrong? Thanks!