赞
踩
1、编写脚本mysql-to-hive.json
{ "job": { "setting": { "speed": { "channel": 3 }, "errorLimit": { "record": 0, "percentage": 0.02 } }, "content": [ { "reader": { "name": "mysqlreader", "parameter": { "username": "用户名", "password": "密码", "column": [ "deptno", "dname", "loc" ], "connection": [ { "table": [ "dept" ], "jdbcUrl": [ "jdbc:mysql://IP:3306/test" ] } ] } }, "writer": { "name": "hdfswriter", "parameter": { "defaultFS": "hdfs://hdfs-ha", "hadoopConfig":{ "dfs.nameservices": "hdfs-ha", "dfs.ha.namenodes.hdfs-ha": "nn1,nn2", "dfs.namenode.rpc-address.hdfs-ha.nn1": "node01:8020", "dfs.namenode.rpc-address.hdfs-ha.nn2": "node02:8020", "dfs.client.failover.proxy.provider.hdfs-ha": "org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider" }, "fileType": "text", "path": "/user/hive/warehouse/ods.db/datax_dept", "fileName": "202104", "column": [ { "name": "deptno", "type": "int" }, { "name": "dname", "type": "varchar" }, { "name": "loc", "type": "varchar" } ], "writeMode": "append", "fieldDelimiter": "\t" } } } ] } }
2、执行脚本
/datax/bin/datax.py ./mysql-to-hive.json
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。