警告
本文最后更新于 2022-08-01 18:23,文中内容可能已过时。
datax是插件机制的,一般插件支持读写,比如mysql,某些插件支持只写比如es的。
插件文档:
https://github.com/alibaba/DataX#support-data-channels
mysql -> mysql示例
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
| {
"core": {
"transport": {
"channel": {
"speed": {
"byte": 10485760
}
}
}
},
"job": {
"setting": {
"speed": {
"channel": 10
}
},
"content": [
{
"reader": {
"name": "mysqlreader",
"parameter": {
"username": "root",
"password": "123456",
"column": ["uid"], # 要同步哪一列
"splitPk": "id", # 主键字段,单通道同步可以不设置
"connection": [ # 要同步的表和库的信息
{
"table": ["user"],
"jdbcUrl": ["jdbc:mysql://xxx:3306/xxx"]
}
]
}
},
"writer": {
"name": "mysqlwriter",
"parameter": {
"writeMode": "insert",
"username": "chaoge_log",
"password": "SimpleLog",
"column": ["newuid"], # 目标表中的字段名
"connection": [ # 目标表和库的信息
{
"jdbcUrl": "jdbc:mysql://xxx:3306/xxx",
"table": ["user"]
}
]
}
}
}
]
}
}
|
开始
1
| python ./bin/datax.py conf/xxx.json
|