首先要做的是将kettle在linux下搭建好。
一、搭建linux的kettle环境
1.1解压
(my_python_env)[root@hadoop26 ~]# unzip pdi-ce-6.0.0.0-353.zip -d /usr/local/kettle/
1.2配置kettle_home
export KETTLE_HOME=/usr/local/kettle
1.3需要把文件资源库的配置拷贝到linux环境下
(my_python_env)[root@hadoop26 kettle]# ls -a . .. data-integration .kettle
1.4拷贝资源库到linux下
(my_python_env)[root@hadoop26 kettle]# ls -a . .. data-integration .kettle local_file_repo
1.5修改.kettle目录下的资源库的映射
<repository> <id>KettleFileRepository</id> <name>local_file_repo</name> <description>local_file_repo</description> <base_directory>/usr/local/kettle/local_file_repo</base_directory> <read_only>N</read_only> <hides_hidden_files>N</hides_hidden_files> </repository>
1.6吧mysql的驱动包放到kettle的lib目录下
二、如何在linux下运行转换和job
2.1不指定资源库的运行方式
1、执行作业
sh /opt/data-integration/kitchen.sh -norep -file **.kjb -level Detailed -param:beginDate=2015-03-08 -param:endDate=2015-03-08
2、执行转换
sh /opt/data-integration/pan.sh -norep -file **.ktr -level Detailed -param:beginDate=2015-03-08 -param:endDate=2015-03-08
2.2指定文件资源库
1、执行作业
sh /opt/data-integration/kitchen.sh -rep kettle_file -job J_exam_core_stat -dir /exam_core_stat -level Detailed -param:queryDate=2015-11-17
2、执行转换
sh /opt/data-integration/pan.sh -rep kettle_file -trans T_O_core_stat -dir /exam_core_stat -level Detailed -param:queryDate=2015-02-28
2.3指定数据库资源库
1、执行作业
sh /opt/data-integration/kitchen.sh -rep online -user admin -pass admin -job J_exam_core_stat -dir /core/exam_core_data_stat/ -level detail -param:queryDate=2014-10-08
2、执行转换
sh /opt/data-integration/pan.sh -rep online -user admin -pass admin -job J_exam_core_stat -dir /core/exam_core_data_stat/ -level detail -param:queryDate=2014-10-08