An OpLog is a collection that records the information about data modifications and insertions on a MongoDB server instance. Typically OpLog is used for data replication.
Hevo supports data ingestion for replication from MongoDB via OpLog. To enable OpLog you will have to do the following changes.
- Changes to be made in the MongoDB server configuration: MongoDB configuration file i.e. mongod.conf is generally found in /etc/ directory in a Linux system. The options to configure are as follow.
- replication.replSetName: The replica set this mongo DB is part of.
- replication.oplogSizeMB: The max size of logs that mongo will persist keep this enough high we recommend 2048 MB (2GB).
- net.bindIp: The IP this mongo DB server should listen to.
- An example config will look like as follows.
net:
bindIp: 0.0.0.0
replication:
replSetName: "repSet0"
oplogSizeMB: 2048
- Configuring replication through Mongo shell: Open your Mongo shell on the replication server and run the following commands
- rs.initiate(): This command will initialize the replica set.
- rs.conf(): This command will show you the replication configuration that has been set.
- rs.status(): This command will show you the replication status.
- Allowing Hevo user to read mongo OpLog: In your Mongo shell run the following commands.
- use <your admin db>
- db.grantRolesToUser('<Hevo user>',[{ role: "read", db: "<db to replicate>" }])
Comments
0 comments
Please sign in to leave a comment.