MongoDB CDC
Your mongo deployment must be running as a replica set or sharded cluster to support change stream events.
Streamdal supports easy ingestion of MongoDB change streams via our CLI utility plumber. No additional configuration in your mongo deployment is required. Simply run plumber in relay mode via the binary or the docker container
You may relay events from your entire mongo deployment, a specific database, or a specific collection.
To relay changes from your entire mongo cluster, OMIT the following variables:
PLUMBER_RELAY_CDCMONGO_DATABASE
PLUMBER_RELAY_CDCMONGO_COLLECTION
To relay changes from a specific database, specify ONLY the following variable
PLUMBER_RELAY_CDCMONGO_DATABASE
To relay changes from a specific collection of a database, specify these two variables
PLUMBER_RELAY_CDCMONGO_DATABASE
PLUMBER_RELAY_CDCMONGO_COLLECTION
Relay via plumber docker container
docker run -d --name plumber-cdcmongo -p 8080:8080 \
-e PLUMBER_RELAY_TYPE=cdc-mongo \
-e PLUMBER_RELAY_CDCMONGO_DSN=mongodb://my.server.com:27017 \
-e PLUMBER_RELAY_CDCMONGO_DATABASE=mydb \
-e PLUMBER_RELAY_CDCMONGO_COLLECTION=customers \
-e PLUMBER_RELAY_TOKEN=YOUR_BATCHSH_TOKEN_HERE \
streamdal/plumber \
mongo
Relay via plumber binary
PLUMBER_RELAY_CDCMONGO_DSN=mongodb://my.server.com:27017
PLUMBER_RELAY_CDCMONGO_DATABASE=mydb \
PLUMBER_RELAY_CDCMONGO_COLLECTION=customers \
PLUMBER_RELAY_TOKEN=YOUR_BATCHSH_TOKEN_HERE \
plumber relay mongo
View events in your Streamdal collection
Change events should start appearing in your Streamdal collection within seconds of them being made in your Mongo deployment.