MongoDB Oplogs on Hidden Nodes

172 Views Asked by At

I understand that the Oplog in a Mongo replicaset is the information being copied to from the primary node to the secondary (or hidden) nodes.

I have an application that stores a lot of pictures. I configured the Primary and Secondary Mongo nodes Oplog size to 50GB. However I do not yet understand how big files, like pictures will behave on the Oplog.

Assume a recently created, empty database. Will the first 50GB worth of pictures be stored twice in the database, once in the Oplog and once in the actual database? Then the Oplog will be refreshed with the new pictures (and will not grow more) and the database will continue growing? If this is the actual case, is this behavior the same for all kinds of nodes? (primary, secondary, hidden...)

What would be the case in a Mongo Hidden Node? The hidden node can never be Primary, does it still have to have an Oplog as big in size as the Oplog in the primary/secondary nodes?

1

There are 1 best solutions below

2
On

For your first question, yes. Oplog have all changes to the database. In this case, every insert (of picture) is inserted to DB and oplog.

When oplog has reached its maximum size, older information is written over with newer.

This will happen in the all nodes of replica set, because any of those nodes (except hidden) can be become primary (basically, of course priority can prevent it IRL).

Oplog should be that big, that any node can "catch up" (recovery) missing changes after "black-out" (initial replication is in same category).

Hidden nodes can have smaller oplog than primary or secondary nodes, but it's practical minimum size is "bigger" than the biggest single insert/update.