7

[JDBC] Kettle on MaxCompute 使用指南

 3 years ago
source link: https://segmentfault.com/a/1190000040356924
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

简介:Kettle是一款开源的ETL工具,纯Java实现,可以在Windows、Unix和Linux上运行,提供图形化的操作界面,可以通过拖拽控件的方式,方便地定义数据传输的拓扑 。基本讲介绍基于Kettle的MaxCompute插件实现数据上云。

Kettle版本:8.2.0.0-342

MaxCompute JDBC driver版本:3.2.8

Setup

  1. 下载并安装Kettle
  2. 下载MaxCompute JDBC driver
  3. 将MaxCompute JDBC driver置于Kettle安装目录下的lib子目录(data-integration/lib)
  4. 下载并编译MaxCompute Kettle plugin:https://github.com/aliyun/ali...
  5. 将编译后的MaxCompute Kettle plugin置于Kettle安装目录下的lib子目录(data-integration/lib)
  6. 启动spoon

我们可以通过Kettle + MaxCompute JDBC driver来实现对MaxCompute中任务的组织和执行。

首先需要执行以下操作:

  1. 新建Job
  2. 新建Database Connection

JDBC连接串格式为:jdbc:odps:?project=

JDBC driver class为:com.aliyun.odps.jdbc.OdpsDriver

Username为阿里云AccessKey Id

Password为阿里云AccessKey Secret

JDBC更多配置见:https://help.aliyun.com/docum...

image.png

之后,可以根据业务需要,通过SQL节点访问MaxCompute。下面我们以一个简单的ETL过程为例:

image.png

Create table节点的配置如下:

image.png

需要注意:

  1. 这里Connection需要选择我们配置好的
  2. 不要勾选Send SQL as single statement

Load from OSS节点配置如下:

image.png

需要注意的点同Create table节点。有关更多Load的用法,见:
https://help.aliyun.com/docum...

Processing节点配置如下:

image.png

需要注意的点同Create table节点。

Transformation

我们可以通过MaxCompute Kettle plugin实现数据流出或流入MaxCompute。

首先新建Transformation,之后新建Aliyun MaxCompute Input节点,配置如下:

image.png

在MaxCompute中新建一张空表,schema与test_partition_table一致。

新建Aliyun MaxCompute Output节点,配置如下:

image.png

执行Transformation,数据便从test_partition_table被下载,后被上传至test_partition_table_2。

设置MaxCompute flags

image.png
如图,在执行DDL/DML/SQL之前,可以通过set key=value;的方式配置flags。

Script模式

暂时无法支持

原文链接

本文为阿里云原创内容,未经允许不得转载。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK