Multiple oplog.rs files in shard cluster

Hi everyone, i’ve an issue. I try to build a shard cluster composed of 3 shards (2 RS and another one for config server). Now i’m testing PITR backups with oplog.rs, but in my cluster, the datas in my collections are randomly distributed between shards and i’ve 2 oplog.rs files (one per replica set). How can i do to restore datas, should i use the 2 oplog files, or juste one of them… ? (i work with shell command on linux)

You need to use both files to restore for “all the data set” in the cluster. But to restore one shard only with a backup in the past, using the oplog file for that shard is enough as shards are independent.

Thank you for your answer @Kobe_W but the fact is that the operations for the same collection are stored in the 2 oplog.rs files.

For example, for a collection “test_collection”, the first operation (an insert of 10 documents) is stored in the oplog.rs n°1, the second operation (a delete of 2 documents) is stored in the oplog.rs n°2, and finaly a third operation (an update of 8 documents) is stored in the oplog.rs file n°1.

So if I want to restore the collection with PITR, i’ve to merge manually the 2 oplog.rs files and it’s really tricky…

I’m not sure if there’s a way to merge multiple oplog files into a single backup. You can check the options regarding oplog for mongorestore tool.