本文主要介绍KETTLE 安装简单使用 SpringBoot如何调取kettle文件进行当量ETL
解压即用 永久分享 链接:https://pan.baidu.com/s/1UmsvthJzCUGOQNNeBYCrmA 提取码:f5c3
打开目录下应用软件即: \pdi-ce-9.0.0.0-423\data-integration\Spoon.bat
1.创建转换文件:文件下方有图标快速创建 创建转换 保存至自主创建工作空间下 2.创建数据库连接 ,举例:MYSQL->ORACLE 根据自己需求进行添加填写 目标源数据库及目标数据库 ;
位置:主对象数-> 转换->转换1(转换名称)-> DB连接 右键新建
点击测试如出此图 为连接成功;
(友情提示:首次添加数据库时 会提示缺失驱动; 请在\pdi-ce-9.0.0.0-423\data-integration\lib 添加相关驱动jar包 ; 在数据库安装路径中即可找到,注意版本)
3.基本应用 Transition基本组成部分为: 目标源输入 、字段对应转换、 自定义数值映射、插入目标库
位置: 核心对象 ->输入 -> 表输入 ; 核心对象 ->转换 ->字段选择 ; 核心对象 ->转换 -> 值映射 ; 核心对象 ->输出 ->插入/更新; 特殊需求:要求添加自增列 如ID 位置: 核心对象 ->转换 -> 增加序列 ;
初步测试方法 : 文件名称下方 点击run即可
步骤:start -> 转换 ->成功
其中转换 要添加 ${Internal.Entry.Current.Directory}/t_set_params.ktr 可识别路径; 如填成了 C:/xxx/xxx.ktr 会造成变更路径不可用 同理点击run即可测试
测试规则: 行级测试 错误信息最为规范:具体问题具体分析
在transition或者job中任何地方使用, 参数可用 ${xxxx} 代替 其中包括全局变量及局部变量 例如:
转换文件 位置 :核心对象-> 作业 -> 设置变量 作业文件 位置:核心对象-> 通用 -> 设置变量 两处都可设置,可按按照自己需求设定
检查是否存在文件: pdi-ce-9.0.0.0-423\data-integration.kettle\kettle.properties 或者 pdi-ce-9.0.0.0-423\data-integration\kettle.properties 本人亲适第二种可用,第一种问官方位置
一般全局变量方便数据统一更换使用;
一般在 /root/.kettle/kettle.properties 这里 如果没有请自行创建 ;
项目为SpringBoot项目 第一步导包 pom.xml中导入这些:
<!--kettle开始 --> <dependency> <groupId>pentaho-kettle</groupId> <artifactId>jsch</artifactId> <version>0.1.54</version> </dependency> <dependency> <groupId>pentaho-kettle</groupId> <artifactId>kettle-core</artifactId> <version>9.0.0.0-423</version> </dependency> <dependency> <groupId>org.mozilla.javascript</groupId> <artifactId>org.mozilla.javascript</artifactId> <version>1.7.0.R2</version> </dependency> <dependency> <groupId>pentaho-kettle</groupId> <artifactId>kettle-engine</artifactId> <version>9.0.0.0-423</version> </dependency> <dependency> <groupId>pentaho-kettle</groupId> <artifactId>vfs2</artifactId> <version>2-2.2</version> </dependency> <dependency> <groupId>pentaho-kettle</groupId> <artifactId>metastore</artifactId> <version>9.0.0.0-423</version> </dependency> <dependency> <groupId>pentaho-kettle</groupId> <artifactId>scannotation</artifactId> <version>1.0.2</version> </dependency> <dependency> <groupId>ojdbc</groupId> <artifactId>ojdbc8</artifactId> <version>1.0.2</version> </dependency> <dependency> <groupId>ojdbc8</groupId> <artifactId>ojdbc8_g</artifactId> <version>1.0.2</version> </dependency> <dependency> <groupId>org.javassist</groupId> <artifactId>javassist</artifactId> <version>3.20.0-GA</version> </dependency> <dependency> <groupId>mail</groupId> <artifactId>mail</artifactId> <version>1.0.0</version> </dependency> <dependency> <groupId>activation</groupId> <artifactId>activation</artifactId> <version>1.0.0</version> </dependency> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> <version>3.4</version> </dependency> <dependency> <groupId>commons-lang</groupId> <artifactId>commons-lang</artifactId> <version>2.6</version> </dependency> <dependency> <groupId>commons-collections</groupId> <artifactId>commons-collections</artifactId> <version>3.2.2</version> </dependency> <!--kettle 结束-->本地在 安装目录下能找到所需要的包 现将其放置mvn中 举例子 自己找包; 也可通过 https://mvnrepository.com/ 进行jar搜索
我自己整理的包: 链接:https://pan.baidu.com/s/1xHIbYDa5aldrcRlF9Q2GuA 提取码:vtho
放入本地mvn方式:Win+R 执行
mvn install:install-file -Dfile=C:\lib\jsch-0.1.54.jar -DgroupId=pentaho-kettle -DartifactId=jsch -Dversion=0.1.54 -Dpackaging=jar mvn install:install-file -Dfile=C:\lib\kettle-core-9.0.0.0-423.jar -DgroupId=pentaho-kettle -DartifactId=kettle-core -Dversion=9.0.0.0-423 -Dpackaging=jar mvn install:install-file -Dfile=C:\lib\kettle-engine-9.0.0.0-423.jar -DgroupId=pentaho-kettle -DartifactId=kettle-engine -Dversion=9.0.0.0-423 -Dpackaging=jar mvn install:install-file -Dfile=C:\lib\metastore-9.0.0.0-423.jar -DgroupId=pentaho-kettle -DartifactId=metastore -Dversion=9.0.0.0-423 -Dpackaging=jar mvn install:install-file -Dfile=C:\lib\commons-vfs2-2.2.jar -DgroupId=pentaho-kettle -DartifactId=vfs2 -Dversion=2-2.2 -Dpackaging=jar mvn install:install-file -Dfile=C:\lib\scannotation-1.0.2.jar -DgroupId=pentaho-kettle -DartifactId=scannotation -Dversion=1.0.2 -Dpackaging=jar mvn install:install-file -Dfile=C:\lib\ojdbc8.jar -DgroupId=ojdbc -DartifactId=ojdbc8 -Dversion=1.0.2 -Dpackaging=jar mvn install:install-file -Dfile=C:\lib\ojdbc8_g.jar -DgroupId=ojdbc8 -DartifactId=ojdbc8_g -Dversion=1.0.2 -Dpackaging=jar mvn install:install-file -Dfile=C:\lib\batik-script-1.9.1.jar -DgroupId=batik -DartifactId=batik-script -Dversion=1.9.1 -Dpackaging=jar mvn install:install-file -Dfile=C:\lib\com.springsource.org.mozilla.javascript-1.7.0.R2.jar -DgroupId=org.mozilla.javascript -DartifactId=org.mozilla.javascript -Dversion=1.7.0.R2 -Dpackaging=jar mvn install:install-file -Dfile=C:\lib\mailapi-1.0.jar -DgroupId=org.mozilla.javascript -DartifactId=mailapi -Dversion=1.0 -Dpackaging=jar mvn install:install-file -Dfile=C:\lib\mail-1.0.0.jar -DgroupId=mail -DartifactId=mail -Dversion=1.0.0 -Dpackaging=jar mvn install:install-file -Dfile=C:\lib\activation-1.0.0.jar -DgroupId=activation -DartifactId=activation -Dversion=1.0.0 -Dpackaging=jar