1024programmer Mongodb How to synchronize MySQL database to MongoDB database

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!” }

This article is from the internet and does not represent1024programmerPosition, please indicate the source when reprinting:https://www.1024programmer.com/how-to-synchronize-mysql-database-to-mongodb-database/

author: admin

Previous article
Next article

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索