DataX 是一个异构数据源离线同步工具,致力于实现包括关系型数据库(MySQL、Oracle等)、HDFS、Hive、ODPS、HBase、FTP等各种异构数据源之间稳定高效的数据同步功能。
1. mysql2mysql.json
{ "job": { "setting": { "speed": { "channel": 1 } }, "content": [{ "reader": { "name": "mysqlreader", "parameter": { "username": "userfoo", "password": "123456", "connection": [{ "querySql": [ "SELECT id, appid, openid, createDate, updateDate FROM tbfoo WHERE appid = 'wxbac1087630';" ], "jdbcUrl": [ "jdbc:mysql://192.168.0.1:3306/dbfoo?characterEncoding=utf8" ] }] } }, "writer": { "name": "mysqlwriter", "parameter": { "writeMode": "insert", "username": "userfoo", "password": "123456", "dateFormat": "YYYY-MM-dd hh:mm:ss", "column": [ "id", "appid", "openid", "createDate", "updateDate" ], "session": [ "set session sql_mode='ANSI'" ], "connection": [{ "jdbcUrl": "jdbc:mysql://192.168.0.2:3306/dbfoo?characterEncoding=utf8", "table": [ "tbfoo" ] }] } } }] } }
2. mongo2mongo.json
{ "job": { "setting": { "speed": { "channel": 1 } }, "content": [{ "reader": { "name": "mongodbreader", "parameter": { "address": ["192.168.0.1:27017"], "query": "{logTime:{$gte:'2020-06-15 12:00:00',$lte:'2020-09-17 12:00:00'}}", "userName": "", "userPassword": "", "dbName": "dbfoo", "collectionName": "collfoo", "column": [{ "index":0, "name": "_id", "type": "string" }, { "index":1, "name": "mac", "type": "string" }, { "index":2, "name": "logTime", "type": "string" }] } }, "writer": { "name": "mongodbwriter", "parameter": { "address": ["192.168.0.2:27017"], "userName": "", "userPassword": "", "dbName": "dbfoo", "collectionName": "collfoo", "column": [{ "index":0, "name": "_id", "type": "string" }, { "index":1, "name": "mac", "type": "string" }, { "index":2, "name": "logTime", "type": "string" }] } } }] } }