How could we tail oplog from a secondary mongodb node in a replica set with debezium kafka connector?

674 views Asked by At

We want to use debezium mongodb kafka source connector against the replica set secondary node rather than primary (at least for the start, to be sure that we are not affecting the main stream functionality in any way).

Debezium mongodb tutorial says that “the connector always uses the replica set’s primary node to tail the oplog”. However, it looks like that by setting auto.discovery to false and specifying secondary node in the connector config make the connector to tail oplog from the secondary node just fine.

So the first question – are we right about it (and it’s not that debezium connector "under the hood" finds a way to the primary node somehow)?

If, indeed, the oplog is tailed from the secondary node (as we want it to be), are there ways to switch to another secondary node automatically if the original one fails?

Thank you.

1

There are 1 answers

0
Gunnar On

The MongoDB connector currently will always connect to the primary node of the replica set. Could you open a feature request in our JIRA tracker for optionally reading from secondary nodes? Any help with implementing it will be welcome of course, too.