![b94506e21e97ab124f2e51ab6855b0e2.png](https://i-blog.csdnimg.cn/blog_migrate/d7b43f7ca878b7857d3cb7da7b6dca4f.jpeg)
Linux下安装使用
1 单机
1)jdk安装
2)安装包上传到服务器,解压
注意:1. 把mysql驱动拷贝到lib目录下
2. 将本地用户家目录下的隐藏目录C:Users自己用户名.kettle,整个上传到linux的家目录/home/atguigu/下
3)运行数据库资源库中的转换:
[atguigu@hadoop102 data-integration]$./pan.sh -rep=my_repo -user=admin -pass=admin -trans=stu1tostu2 -dir=/
参数说明:
-rep 资源库名称
-user 资源库用户名
-pass 资源库密码
-trans 要启动的转换名称
-dir 目录(不要忘了前缀 /)
![155d5d6f7975127ab1e3c5ab6d4351b3.png](https://i-blog.csdnimg.cn/blog_migrate/aaa3339c948287c3afd913abbc04f5c7.jpeg)
4)运行资源库里的作业:
记得把作业里的转换变成资源库中的资源
[atguigu@hadoop102 data-integration]$./kitchen.sh -rep=repo1 -user=admin -pass=admin -job=jobDemo1 -logfile=./logs/log.txt -dir=/
参数说明:
-rep – 资源库名
-user – 资源库用户名
-pass – 资源库密码
-job – job名
-dir – job路径
-logfile – 日志目录
2 集群模式(了解)
1) 准备三台服务器,hadoop102作为Kettle主服务器,服务器端口号为8080,hadoop103和hadoop104作为两个子服务器,端口号分别为8081和8082。
2) 安装部署jdk
3) hadoop完全分布式环境搭建,并启动进程(因为要使用hdfs)
4) 上传解压kettle的安装包
5) 进到/opt/module/data-integration/pwd目录,修改配置文件
修改主服务器配置文件carte-config-master-8080.xml
<slaveserver>
<name>master</name>
<hostname>hadoop102</hostname>
<port>8080</port>
<master>Y</master>
<username>cluster</username>
<password>cluster</password>
</slaveserver>
修改从服务器配置文件carte-config-8081.xml
<masters>
<slaveserver>
<name>master</name>
<hostname>hadoop102</hostname>
<port>8080</port>
<username>cluster</username>
<password>cluster</password>
<master>Y</master>
</slaveserver>
</masters>
<report_to_masters>Y</report_to_masters>
<slaveserver>
<name>slave1</name>
<hostname>hadoop103</hostname>
<port>8081</port>
<username>cluster</username>
<password>cluster</password>
<master>N</master>
</slaveserver>
修改从配置文件carte-config-8082.xml
<masters>
<slaveserver>
<name>master</name>
<hostname>hadoop102</hostname>
<port>8080</port>
<username>cluster</username>
<password>cluster</password>
<master>Y</master>
</slaveserver>
</masters>
<report_to_masters>Y</report_to_masters>
<slaveserver>
<name>slave2</name>
<hostname>hadoop104</hostname>
<port>8082</port>
<username>cluster</username>
<password>cluster</password>
<master>N</master>
</slaveserver>
6) 分发整个kettle的安装目录,xsync data-integration
7) 启动相关进程,在hadoop102,hadoop103,hadoop104上执行
[atguigu@hadoop102 data-integration]$./carte.sh hadoop102 8080
[atguigu@hadoop103 data-integration]$./carte.sh hadoop103 8081
[atguigu@hadoop104 data-integration]$./carte.sh hadoop104 8082
8) 访问web页面
http://hadoop102:8080
9) 案例:读取hive中的emp表,根据id进行排序,并将结果输出到hdfs上
注意:因为涉及到hive和hbase的读写,需要修改相关配置文件。
修改解压目录下的data-integrationpluginspentaho-big-data-plugin下的plugin.properties,设置active.hadoop.configuration=hdp26,并将如下配置文件拷贝到data-integrationpluginspentaho-big-data-pluginhadoop-configurationshdp26下
![8438e347e54381ba4314bb3f07a5beb5.png](https://i-blog.csdnimg.cn/blog_migrate/2fd0422555d85690b9a8a2261896778e.jpeg)
(1) 创建转换,编辑步骤,填好相关配置
![c0ebad4f61b4bfa80ab8f9f00d4815d2.png](https://i-blog.csdnimg.cn/blog_migrate/8461ffd100bcbde042790818ca8a4418.png)
(2) 创建子服务器,填写相关配置,跟集群上的配置相同
![48a066a5bc4d9500bbf078b427f93482.png](https://i-blog.csdnimg.cn/blog_migrate/81655de8a37651d87332cbb06b47f919.png)
![10cf9fe9c27e7fa65add071de439edaa.png](https://i-blog.csdnimg.cn/blog_migrate/18e08914cfba155d8579ee6ccaad97d6.png)
![4195c876dc3c7fcee3a76adf13d40e9f.png](https://i-blog.csdnimg.cn/blog_migrate/fe4d0db877bb7f373f1e6fd724993bdc.png)
![63b27b6f85c61af81112a308471f4eac.png](https://i-blog.csdnimg.cn/blog_migrate/5cab773fcad4a2df5c706caf7a5bd72e.png)
(3) 创建集群schema,选中上一步的几个服务器
![203351d382a90ee863aeed8e475400eb.png](https://i-blog.csdnimg.cn/blog_migrate/0b44bc005c19f2cc6bc9d5e7f4c0efda.jpeg)
(4) 对于要在集群上执行的步骤,右键选择集群,选中上一步创建的集群schema
![c4de395defbd8bbc55c800b2ccc24d67.png](https://i-blog.csdnimg.cn/blog_migrate/b68d8ed99fa18f7e954ec6d18bc0d382.jpeg)
(5) 创建Run Configuration,选择集群模式,直接运行
![23bec6e5cd097f61be504e4bd277ce7c.png](https://i-blog.csdnimg.cn/blog_migrate/5fbd8044b878371e133d25cbb90d51a0.png)
![c1c2132953eb97cb97ae2a31ea9e540f.png](https://i-blog.csdnimg.cn/blog_migrate/8d0fe16de460b084d0da7d43ea73abe5.png)
![403960a2648c40a00f58e1633dbeeb1a.png](https://i-blog.csdnimg.cn/blog_migrate/9e70af126c7bd6c8b7c42ee391e7e524.jpeg)