Book Image

MongoDB High Availability

By : Afshin Mehrabani
Book Image

MongoDB High Availability

By: Afshin Mehrabani

Overview of this book

Table of Contents (17 chapters)
MongoDB High Availability
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Understanding oplog


Oplog is used to record all database changes in a collection of data.

An oplog (operations log) is a special capped collection that keeps a rolling record of all the operations that modify the data stored in your databases (http://docs.mongodb.org/manual/core/replica-set-oplog/).

It is a fixed-size collection, and it will automatically overwrite old records when it reaches the maximum size of the collection. Oplog is used in the replication procedure to facilitate the process of replication between primary and secondary nodes.

The secondary nodes copy the primary's oplog and apply it, so all members will have oplog that saves the current state and recent history of the database.

The first time you add a replica set to the database, the server creates oplog with its default size. The size of oplog varies, and it depends on the operating system and machine architecture. However, you can define and change the default size of oplog using the oplogSize property.

The following...