kettle安装下载地址:

官网地址:

https://community.hitachivantara.com/s/article/data-integration-kettle

下载地址:

https://sourceforge.net/projects/pentaho/files/

kettle是一款开源的ETL工具,纯java编写,可以在Windows、Linux、Unix上运行,绿色无需安装,数据抽取高效稳定。

打开直接可以用。

使用kettle之前要确保jdk安装配置完成。

 

安装jdk

 

下载地址:

 

http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

 

同意相关协议,再下载对应版本的jdk(windows x64)

 

 

kettle 连接hive method not supported kettle连接informix_mysql

 

下载软件为

kettle 连接hive method not supported kettle连接informix_mysql_02

,双击安装

 

 

kettle 连接hive method not supported kettle连接informix_字段_03

 

 

 

 

下一步继续安装(需要注意路径)

 

 

kettle 连接hive method not supported kettle连接informix_mysql_04

 

 

 

 

下一步等待安装完成。安装目录如下所示

 

 

kettle 连接hive method not supported kettle连接informix_字段_05

 

 

 

 

 

 

2)下载kettle压缩包,因为kettle为绿色软件,解压缩到任意本地路径即可

 

 

kettle 连接hive method not supported kettle连接informix_字段_06

 

 

 

 

3)双击Spoon.bat,启动图形化界面工具即可使用

 

 

kettle 连接hive method not supported kettle连接informix_字段_07

 

 

 简单使用:

1.把stu1的数据按id同步到stu2,stu2有相同id则更新数据

 

在mysql中创建两张表

mysql>create database kettle;
mysql>use kettle;
mysql>create table stu1 (id int ,name varchar(20),age int);
mysql>create table stu2 (id int ,name varchar(20));

 

往两张表中插入一些数据

 

mysql>insert into stu1 values(1001,’zhangsan’,20),(1002,’lisi’,18),(1003,’wangwu’,23);
mysql>insert into stu2 values(1001,’wukong’);

在kettle中新建转换

打开kettle后,点击左上角转换

kettle 连接hive method not supported kettle连接informix_mysql_08

 

 

 

 

进入

kettle 连接hive method not supported kettle连接informix_字段_09

 

 

 

点击输入,在下方找到表输入,双击或者直接拖拽到中间

kettle 连接hive method not supported kettle连接informix_字段_10

 

 

 

kettle 连接hive method not supported kettle连接informix_mysql_11

 

 

 

双击表输入,在数据库连接中配置mysql数据库连接

注意,若mysql版本为8以前,需要将mysql-connector-java-5.1.34-bin.jar放在kettle的lib文件夹中

然后根据图示进行连接:

kettle 连接hive method not supported kettle连接informix_java_12

 

 

 

 

若mysql版本为8,则需要先找到 data-integration\simple-jndi\jdbc.properties 文件

编辑,在末尾加上连接信息:

 

MYSQL8_DB/type=javax.sql.DataSource  //MYSQL8_DB可以随便更改
 
MYSQL8_DB/driver=com.mysql.cj.jdbc.Driver
 
MYSQL8_DB/url=jdbc:mysql://localhost:3306/xxxxx?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT //xxxxx为想要连接数据库名称
 
MYSQL8_DB/user=root  //用户名
 
MYSQL8_DB/password=root //密码
接着,按照下图进行连接,JNDI名称为上面添加的,可更改

 

 

kettle 连接hive method not supported kettle连接informix_java_13

 

 

 配置连接数据库之后,

sql语句中输入select * from stu1;

kettle 连接hive method not supported kettle连接informix_mysql_14

 

 

 

点击预览可以看到数据

 

kettle 连接hive method not supported kettle连接informix_字段_15

 

 

在输出中找到插入/更新组件,双击或者直接拖拽到中间,

点住表输入shift+鼠标左键连接到插入/更新组件上

kettle 连接hive method not supported kettle连接informix_java_16

 

 

 

双击插入/更新,点击目标表浏览,选择stu2

kettle 连接hive method not supported kettle连接informix_字段_17

 

 

 

点击获取字段获取到3个字段

kettle 连接hive method not supported kettle连接informix_mysql_18

 

 

 

由于stu1与stu2通过id关联,故删除另2个字段,

选中name、age字段,点击键盘上delete键进行删除

然后点击编辑映射,编辑2个表之间的映射

 

 

 

 

kettle 连接hive method not supported kettle连接informix_java_19

 

 

 

确定后如图

kettle 连接hive method not supported kettle连接informix_mysql_20

 

 

更新处,修改id的属性为N,确定

保存运行,到数据库中查看结果。