alibaba / alibaba/DataX

使用datax批量同步数据表的操作方法

Open
#678 2 comments 1 reaction 0 assignees View on GitHub
Dominant language
Java
Stars
17.4k
Forks
5.7k
PR merge metrics
No merged PRs in 30d

Description

2.json
```
{
"job": {
"content": [
{
"reader": {
"name": "mysqlreader",
"parameter": {
"column": [
"*"
],
"connection": [
{
"jdbcUrl": ["jdbc:mysql://192.168.1.12:3306/origin_db?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8$],
"table": ["$tableName"]
}
],
"password": "pass",
"username": "user"
}
},
"writer": {
"name": "mysqlwriter",
"parameter": {
"column": [
"*"
],
"connection": [
{
"jdbcUrl": "jdbc:mysql://192.168.1.2:3306/db2",
"table": ["$tableName"]
}
],
"password": "pass",
"username": "user",
"writeMode": "replace"
}
}
}
],
"setting": {
"speed": {
"channel": 5
}
}
}
}
```

2.table
```
table1
table2
table3
```

run.sh
```
#!/bin/bash
for tablename in `cat 2.table`;
do python2 /opt/datax/bin/datax.py -p"-DtableName=${tablename}" 2.json;
done
```

有在用的可以参考测试一下。

其他问题:
```
column 这里如果遇到关键字导致select失败的,可以这样添加字段名
"`order`","`interval`","id"
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Review the issue's 2.json configuration, 2.table input, and run.sh entry point, including the datax.py invocation and MySQL reader/writer settings. Determine where this usage example belongs in the repository and verify the documented batch-sync procedure, including escaping reserved column names. Done means the procedure is placed in the appropriate documentation location and is understandable to users.

Written by the indexing model from the issue text.

Assessment

Tech stack
mysql, python, shell
Domain
data-engineering, databases, documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.