datax读取hive表有两种方式,一种是读取hdfs文件路径HDFSReader,因为hive是存储在hdfs上。第二种是读取hive表RDBMSReader。
HDFSReader
{ "job": { "setting": { "speed": { "channel": 3 }, "errorLimit": { "record": 0, "percentage": 0.02 } }, "content": [{ "reader": { "name": "hdfsreader", "parameter": { "path": "/user/hive/warehouse/ods.db/ods.ods_count/*", "defaultFS": "hdfs://ip:9000", "column": [{ "type": "STRING", "index": "0" }, { "type": "STRING", "index": "1" } ], "fileType": "orc", "fieldDelimiter": "\u0001", "nullFormat": "null" } }, "writer": { "name": "doriswriter", "parameter": { "loadUrl": ["ip:8031"], "loadProps": { "column_separator": "\\x01", "line_delimiter": "\\x02" }, "database": "ads", "column": [ "ID", "NAME" ], "username": "${mysqlwriterUsername}", "password": "${mysqlwriterPassword}", "postSql": [], "preSql": ["truncate table count"], "connection": [{ "jdbcUrl": "jdbc:mysql://IP:9031/ads?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai", "table": ["count"], "selectedDatabase": "ads" }] } } }] } }
RDBMSReader
{ "job": { "setting": { "speed": { "channel": 3 }, "errorLimit": { "record": 0, "percentage": 0.02 } }, "content": [{ "reader": { "name": "rdbmsreader", "parameter": { "username": "${hiveusername}", "password": "${hivepassword}", "splitPk": "", "connection": [{ "querySql": [ "select * from ods.test where 1 = 1" ], "jdbcUrl": ["jdbc:hive2://ip:port/default"] }] } }, "writer": { "name": "doriswriter", "parameter": { "loadUrl": ["IP:PORT"], "loadProps": { "column_separator": "\\x01", "line_delimiter": "\\x02" }, "database": "ads", "column": [ "ID", "NAME" ], "username": "${mysqlwriterUsername}", "password": "${mysqlwriterPassword}", "postSql": [], "preSql": ["truncate table count"], "connection": [{ "jdbcUrl": "jdbc:mysql://${writeJdbcUrl}", "table": ["count"], "selectedDatabase": "ads" }] } } }] } }
标签:count,ads,column,表到,ods,hive,datax,doris,name From: https://www.cnblogs.com/chong-zuo3322/p/18218228