How to synchronize MySQL database to MongoDB database
NoSQL is very popular, but to use it in a real environment, many people may still have a lot of concerns. A common practice is to write double data, first observe the situation and then decide whether to migrate. The following tool may be a boon for those students who want to migrate from MySQL to MongoDB. This is not a simple data import tool, but a real-time synchronization of data in MySQL to MongoDB. It is equivalent to MongoDB as a MySQL from library. This tool is based on an open source project called tungsten-replicator, and the tools are all open source. You can directly checkout the code to install and use it now. Schematic: The effect after installation: Execute the following SQL for creating tables and inserting data in MySQL: mysql> create table foo(id int primary key, msg varchar(35)); Query OK, 0 rows affected (0.05 sec) mysql> insert into foo values(1, ‘hello from MySQL!’); Query OK, 1 row affected (0.00 sec) The corresponding data can then be found in MongoDB: > show collections foo system.indexes > db.foo.find(); { “_id” : ObjectId(“4dc55e45ad90a25b9b57909d”), “1” : “1”, “2” : “hello from MySQL!” }