一、描述任务
使用Datax抽取mysql中的数据到hive的wedw_ods层中,mysql的库名为:b.p.n.p 表名为:bene_group
二、datax.json脚本生成
因为datax的脚本是自动生成的,生成的格式如下:
{
"core": {
},
"job": {
"content": [
{
"reader": {
"name": "mysqlreader",
"parameter": {
"column": [
"ID",
"REPLACE(REPLACE(REPLACE(Name,'\n',''),'\r',' '),'\t',' ')",
"Locked",
"REPLACE(REPLACE(REPLACE(Info,'\n',''),'\r',' '),'\t',' ')"
],
"connection": [
{
"jdbcUrl": [
"jdbc:mysql://10.60.10.206:3306/b.p.n.p"
],
"table": [
"b.p.n.p.bene_group"
]
}
],
"password": "123456",
"splitPk": "ID",
"username": "root"
}
},
"writer": {
"name": "hdfswriter",
"parameter": {
"column": [
{
"name": "ID",
"type": "string"
},
{
"name": "Name",
"type": "string"
},
{
"name": "Locked",
"type": "int"
},
{
"name": "Info",
"type": "string"
}
],
"defaultFS": "hdfs://bigdata",
"encoding": "utf-8",
"fieldDelimiter": "\t",
"fileName": "bpnp_bene_group_df",
"fileType": "text",
"hadoopConfig": {
"dfs.namenode.rpc-address.bigdata.nn2": "10.60.8.109:8020",
"dfs.ha.namenodes.bigdata": "nn1,nn2",
"dfs.namenode.rpc-address.bigdata.nn1": "10.60.8.108:8020",
"dfs.client.failover.proxy.provider.bigdata": "org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider",
"dfs.nameservices": "bigdata"
},
"path": "/data/hive/warehouse/wedw_ods.db/bpnp_bene_group_df",
"writeMode": "append"
}
}
}
],
"setting": {
"errorLimit": {
"percentage": 0.0,
"record": 0
},
"speed": {
"channel": 1
}
}
}
}
三、修改脚本的表名为
这样就可以了。