MongoDB to MySQL Data Streaming
Streaming data in MongoDB to MySQL database in realtime. Enable SQL query on data in NoSQL database.
Configurations:
- Update the mongodb configuration in
config.json
-
Add index manually, for example:
ALTER TABLE blog_posts ADD PRIMARY KEY (_id);
ALTER TABLE blog_posts ADD INDEX field1 (field1);
ALTER TABLE blog_posts ADD INDEX _order_id (_order, _id);
-
Import the old data in MongoDB collection to MySQL table:
node app.js import
-
Start the daemon to streaming data
node start app.js or forever start app.js
-
A MySQL table mongo_to_mysql will be created to store required information.
-
Update the transform() to change field names or modify values during streaming.