Here we will walk through the steps to send data from a relational database to MongoDB using SymmetricDS. Since SymmetricDS is trigger based and there are not triggers in MongoDB data can only synchronized to a MongoDB instance.
Lets begin the MongoDB synchronization ...
- Install MongoDB and run.
- Install SymmetricDS Pro and run.
- Create a new master node through the SymmetricDS Pro web console and connect it to your source relational database of choice. In this example I used Microsoft SQL Server.
- Create a second node. A second node is required to attach to a relational database to store SymmetricDS system tables.
- I choose to create a local node since this is just a lightweight database to hold SymmetricDS configuration only.
- When selecting your relational database for the second node I would recommend H2.
- Once the second node has registered (verified on Managed -> Nodes screen), stop SymmetricDS.
- Locate your engine properties file on your file system. There should be two files one for your master and one for the H2 node.
{SYM_HOME}/engines/***.properties
Add the following properties for your H2 node and adjust as needed. I do not have user/pass for my MongoDB so these are commented out.#mongodb.username=xxxx #mongodb.password=xxxx mongodb.host=localhost mongodb.port=27017 mongodb.default.databasename=mongoBlog - Startup SymmetricDS
- Create a new channel with the mongodb data loader selected.
- Setup triggers and link routers to use the new channel
- Insert data into the source table
- Verify the data made it to your MongoDB
- Congratulations your MongoDB synchronization is ready!