Replicate MongoDB® Collections to SingleStore
On this page
Change Data Capture (CDC) pipelines enable you to ingest historical data and sync the continuous changes to data as they happen on the source MongoDB® database.
-
Replicate MongoDB® Collections using MongoDB® Wrapper Commands through the SingleStore Kai endpoint
To replicate data from MongoDB® using CDC via AWS PrivateLink, refer to Replicate MongoDB® Collections via AWS PrivateLink.
Prerequisites
Source Database Requirements
The replication feature uses MongoDB® change streams, and it works only with replica sets.
-
Read the
admin
database for the operation log (oplog) -
Read the
config
database in the configuration server -
listDatabases
privilege -
Cluster-wide
find
andchangeStream
privileges -
Write permission to the
singlestore
database.The singlestore
database is automatically created during the replication process.
You can provide the privileges or assign roles to the MongoDB® user using the MongoDB® Atlas UI or MongoDB® commands.
-
Using the UI for MongoDB® Atlas:
-
On the MongoDB® Cloud dashboard, select Projects > <your_
project>. -
In the left navigation pane, under Security, select Database Access.
-
On the Database Users page, select Edit for the MongoDB® user used to connect to the MongoDB® instance.
-
On the Edit User dialog, under Database User Privileges, select Specific Privileges > Add Specific Privilege.
-
Add the following privileges:
-
readAnyDatabase
-
read
for theconfig
database -
readWrite
for thesinglestore
database
-
-
Select Update User.
-
-
Using MongoDB® commands for self-managed deployments: The following commands create a role and then assign the role to a user.
db.adminCommand({ createRole: 'cdcRole',privileges: [{'resource': {'cluster': true}, 'actions': ['find', 'changeStream']}],roles: [{'role': 'read', 'db': 'admin'},{'role': 'read', 'db': 'local'},{'role': 'read', 'db': 'config'},{'role': 'readWrite', 'db': 'singlestore'}]})db.adminCommand({ createUser: 'cdcUser',pwd: 's2mongoCDC12',roles: ['cdcRole']})Refer to Database Commands for more information.
Allow Access to the MongoDB® Instance
To allow SingleStore to connect to your MongoDB® instance (MongoDB® Atlas or self-managed deployment), allow incoming traffic from the outbound IP addresses of your SingleStore Helios workspace group.
Note
Allow all the outbound IP addresses.
-
Copy the outbound IP address of your SingleStore Helios workspace.
-
On the Cloud Portal, select Deployments > <your_
workspace_ group> > Firewall > Outbound. -
Copy all the IPs listed under IPs for Outbound Connections.
-
-
Allow incoming traffic to the MongoDB® instance from the SingleStore Helios outbound IP addresses.
Follow the instructions for your deployment: -
For MongoDB® Atlas deployments, add the outbound IPs to the MongoDB® IP Access List.
Refer to Configure IP Access List Entries for related information. -
For MongoDB® self-managed deployments, allow incoming traffic from the IP addresses.
Refer to Network and Configuration Hardening for more information.
-
Limitations
-
SingleStore does not support data replication using CDC pipelines from MongoDB® Atlas standalone or serverless instances.
Replication is only supported for replica set deployments. -
Because MongoDB® time series collections do not support change streams, they cannot be replicated in SingleStore using CDC.
Refer to Time Series Collection Limitations for more information.
In this section
Last modified: September 11, 2024