Sync Relational Databases to NoSQL like MongoDB

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 …

  1. Install MongoDB and run.
  2. Install SymmetricDS Pro and run.
  3. 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 Master Node
  4. Create a second node. A second node is required to attach to a relational database to store SymmetricDS system tables.

    Create a Second Node for SymmetricDS Configuration
  5. I choose to create a local node since this is just a lightweight database to hold SymmetricDS configuration only.

    Select a Local Node
  6. When selecting your relational database for the second node I would recommend H2.

    Attach the Node to an H2 Relational Database
  7. Once the second node has registered (verified on Managed -> Nodes screen), stop SymmetricDS.
  8. 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

  9. Startup SymmetricDS
  10. Create a new channel with the mongodb data loader selected.

    Create A Channel with MongoDB Data Loader
  11. Setup triggers and link routers to use the new channel

    Use New MongoDB Channel On Linked Triggers
  12. Insert data into the source table

    Test Data Added to Source Table
  13. Verify the data made it to your MongoDB

    Verify the data is in MongoDB
  14. Congratulations your MongoDB synchronization is ready!