海豚调度 配置datax
时间: 2023-12-27 12:25:05 浏览: 191
海豚调度是一个用于数据抽取和数据同步的开源调度平台,而DataX是海豚调度中用于数据抽取的组件。下面是两种配置DataX的方式:
1. 使用海豚自带的DataX组件实现数据抽取:
```shell
{
"job": {
"content": [
{
"reader": {
"name": "mysqlreader",
"parameter": {
"username": "your_username",
"password": "your_password",
"column": ["column1", "column2"],
"connection": [
{
"querySql": [
"SELECT * FROM your_source_table"
],
"jdbcUrl": [
"jdbc:mysql://your_mysql_host:your_mysql_port/your_database"
]
}
]
}
},
"writer": {
"name": "postgresqlwriter",
"parameter": {
"username": "your_username",
"password": "your_password", "column": ["column1", "column2"],
"connection": [
{
"jdbcUrl": "jdbc:postgresql://your_postgresql_host:your_postgresql_port/your_database",
"table": "your_target_table"
}
]
}
}
}
],
"setting": {
"speed": {
"channel": "3"
}
}
}
}
```
2. 在海豚调度中调用shell脚本实现数据抽取,抽取配置写在shell脚本中,需要配置reader和writer:
```shell
#!/bin/bash
datax/bin/datax.py your_job.json
```
其中,your_job.json是包含DataX配置的JSON文件。
阅读全文