1、安装kettle9客户端,自行百度安装,官网: Kettle — 安装和部署 – Kettle中文网。
2、创建项目,引入jar包。( springbootIntegrationKettle9: springboot集成kettle9的项目demo)
3、进入到kettle的安装目录下(data-integration),打开命令行窗口,执行下面的 命令,以便项目中能够发送kettle转换和作业去执行。注意:命令开头是 nohup nohup nohup !!!
nohup ./carte.sh pwd/carte-config-master-8080.xml & 4、安装目录data-integration下的pwd文件夹下的 carte-config-master-8080.xml文件中配置了访问kettle的用户名,密码信息,默认账号密码为:cluster。在步骤3启动后,输入 http://127.0.0.1:8080/ 可以用来看kettle作业和转换的执行结果日志。
application-local.yaml文件中需配置kettle调用的地址,端口号,用户名,密码等信息。
server:
servlet:
context-path: /fat-sheep
port: 8081
#kettle配置
kettle:
servers: #集群请配置多个配置项
- url: 127.0.0.1 #主机host地址
port: 8080 #主机服务端口
username: cluster #主机服务账号
pwd: cluster #主机服务密码
planPath: kettle/plan/ #转换文件路径,resources文件夹下,自己写的转换放到这里,项目才能找到
jobPath: kettle/job/ #作业文件路径,resources文件夹下,自己写的作业放到这里,项目才能找到5、项目中遇到的问题:
5.1、项目中kettle相关的jar包通过maven下载不下来。我通过在网络上的maven仓库( https://mvnrepository.com/) 下载下对应的jar包,然后放到本地的maven仓库中,执行命令将jar引入maven仓库中。(如果未设置仓库路径则在/Users/liwentao/.m2/repository下,Windows位于 C:\Users\用户名.m2目录下 )
进入到该jar的下载位置,打开命令行窗口,执行命令下面的命令,出现bulid success就说明成功了。
mvn install:install-file -Dfile=metastore-9.1.0.0-324.jar -DgroupId=pentaho-kettle -DartifactId=metastore -Dversion=9.1.0.0-324 -Dpackaging=jar maven命令解释:
-Dfile:指明你当前jar包的位置;
-DgroupId, -DartifactId, -Dversion:三个参数,就是指明了存放maven仓库中的位置;
-Dpackaging :指明文件类型;
这里的jar会自动打到maven的配置文件settings.xml中配置的仓库路径中。
5.2、项目启动时报错:org.pentaho.di.core.exception.KettleException:
Unable to find plugin with ID 'Kettle'. If this is a test, make sure kettle-core tests jar is a dependency. If this is live make sure a kettle-password-encoder-plugins.xml exits in the classpath
解决办法:在项目的resources下创建名为kettle-password-encoder-plugins.xml的文件,内容为:
<password-encoder-plugins>
<password-encoder-plugin id="Kettle">
<description>Kettle Password Encoder</description>
<classname>org.pentaho.di.core.encryption.KettleTwoWayPasswordEncoder</classname>
</password-encoder-plugin>
</password-encoder-plugins> 5.3、出现各种:java.lang.NoClassDefFoundError: XXX
解决方法:缺少哪个类,就找相应的依赖引入pom文件中即可。
版权声明:本文为weixin_42342164原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。