Linux-下安装使用-单机安装kettle
一、配置jdk
1.查看安装java
[root@test1 tools]# yum -y install gcc gcc-c++
[root@test1 tools]# rpm -qa |grep java
2.强制卸载
[root@test1 tools]# rpm -e --nodeps java-1.7.0-openjdk-1.7.0.9-2.3.4.1.el6_3.i686
[root@test1 tools]# rpm -e --nodeps java-1.6.0-openjdk-1.6.0.0-1.50.1.11.5.el6_3.i686
3.安装
[root@test1 tools]# rpm -ivh jdk-8u131-linux-x64.rpm
4.默认安装路径
[root@test1 tools]# /usr/java/jdk1.8.0_131
5.配置环境变量
[root@test1 tools]# vim /etc/profile
export JAVA_HOME=/usr/java/jdk1.8.0_131
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
6.使其立即生效
[root@test1 tools]# source /etc/profile
7.查看是否安装成功
[root@test1 tools]# java -version
二、部署kettle(kettle本身是无需安装,只需要解压即可)
1:创建一个目录,
[root@test1 tools]# mkdir -p /usr/local/kettl
将下载好的kettle解压后放在该文件夹下。
[root@test1 tools]# cp pdi-ce-7.1.0.0-12.zip /usr/local/kettle/
[root@test1 tools]# cd /usr/local/kettle/
[root@test1 kettle]# ll
total 882680
-rw-r--r--. 1 root root 903861282 Sep 23 07:12 pdi-ce-7.1.0.0-12.zip
[root@test1 kettle]# unzip pdi-ce-7.1.0.0-12.zip //解压
[root@test1 kettle]# cd data-integration/
[root@test1 data-integration]# yum install webkitgtk-2.4.9-1.el7.x86_64.rpm
//查看.sh
[root@test1 data-integration]# ll *.sh
-rwxr-xr-x. 1 root root 405 May 16 2017 carte.sh
-rwxr-xr-x. 1 root root 140 May 16 2017 encr.sh
-rwxr-xr-x. 1 root root 275 May 16 2017 import.sh
-rwxr-xr-x. 1 root root 354 May 16 2017 kitchen.sh
-rwxr-xr-x. 1 root root 320 May 16 2017 pan.sh
-rwxr-xr-x. 1 root root 347 May 16 2017 purge-utility.sh
-rwxr-xr-x. 1 root root 305 May 16 2017 runSamples.sh
-rwxr-xr-x. 1 root root 3710 May 16 2017 set-pentaho-env.sh
-rwxr-xr-x. 1 root root 309 May 16 2017 spark-app-builder.sh
-rwxr-xr-x. 1 root root 1051 May 16 2017 SpoonDebug.sh
-rwxr-xr-x. 1 root root 6355 May 16 2017 spoon.sh
-rwxr-xr-x. 1 root root 1628 May 16 2017 yarn.sh
//以.sh结尾的文件(命令脚本)必须拥有执行权限,如果没有,请赋予***
[root@test1 data-integration]# chmod +x *.sh
[root@test1 data-integration]# ll *.sh
-rwxr-xr-x. 1 root root 405 May 16 2017 carte.sh
-rwxr-xr-x. 1 root root 140 May 16 2017 encr.sh
-rwxr-xr-x. 1 root root 275 May 16 2017 import.sh
-rwxr-xr-x. 1 root root 354 May 16 2017 kitchen.sh
-rwxr-xr-x. 1 root root 320 May 16 2017 pan.sh
-rwxr-xr-x. 1 root root 347 May 16 2017 purge-utility.sh
-rwxr-xr-x. 1 root root 305 May 16 2017 runSamples.sh
-rwxr-xr-x. 1 root root 3710 May 16 2017 set-pentaho-env.sh
-rwxr-xr-x. 1 root root 309 May 16 2017 spark-app-builder.sh
-rwxr-xr-x. 1 root root 1051 May 16 2017 SpoonDebug.sh
-rwxr-xr-x. 1 root root 6355 May 16 2017 spoon.sh
-rwxr-xr-x. 1 root root 1628 May 16 2017 yarn.sh
2:测试安装是否成功
在kettle的data-integration目录中执行kitchen.sh文件,若出现帮助信息,证明安装成功
[root@test1 data-integration]# ./kitchen.sh
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
Options:
-rep = Repository name
-user = Repository username
-pass = Repository password
-job = The name of the job to launch
-dir = The directory (dont forget the leading /)
-file = The filename (Job XML) to launch
-level = The logging level (Basic, Detailed, Debug, Rowlevel, Error, Minimal, Nothing)
-logfile = The logging file to write to
-listdir = List the directories in the repository
-listjobs = List the jobs in the specified directory
-listrep = List the available repositories
-norep = Do not log into the repository
-version = show the version, revision and build date
-param = Set a named parameter <NAME>=<VALUE>. For example -param:FILE=customers.csv
-listparam = List information concerning the defined parameters in the specified job.
-export = Exports all linked resources of the specified job. The argument is the name of a ZIP file.
-custom = Set a custom plugin specific option as a String value in the job using <NAME>=<Value>, for example: -custom:COLOR=Red
-maxloglines = The maximum number of log lines that are kept internally by Kettle. Set to 0 to keep all rows (default)
-maxlogtimeout = The maximum age (in minutes) of a log line while being kept internally by Kettle. Set to 0 to keep all rows indefinitely (default)
[root@test1 data-integration]#
若是如图所示,则恭喜你,安装成功
运行数据库资源库中的转换:
cd /usr/local/soft/data-integration
./pan.sh -rep=my_repo -user=admin -pass=admin -trans=tran1
参数说明:
-rep 资源库名称
-user 资源库用户名
-pass 资源库密码
-trans 要启动的转换名称
-dir 目录(不要忘了前缀 /)(如果是以ktr文件运行时,需要指定ktr文件的路径)
运行资源库里的作业:
记得把作业里的转换变成资源库中的资源
cd /usr/local/soft/data-integration
./kitchen.sh -rep=my_repo -user=admin -pass=admin -job=job1 -logfile=./logs/log.txt
参数说明:
-rep - 资源库名
-user - 资源库用户名
-pass – 资源库密码
-job – job名
-dir – job路径(当直接运行kjb文件的时候需要指定)
-logfile – 日志目录