目标
linux下使用crond定时执行kettle的job部署
配置 JAVA 环境
1. 官网下载JRE
https://www.oracle.com/java/technologies/javase-server-jre8-downloads.html
(JDK 步骤相同:https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html)
2. 安装 JAVA
# 解压 jdk
tar -xvf jdk-8u271-linux-x64.tar.gz -C /usr/local/java
3. 编写环境配置
# 配置环境变量 在最后增加
vim /etc/profile
export JAVA_HOME=/usr/local/java/jdk1.8.0_271
export PATH=$JAVA_HOME/bin:$PATH
# 重新载入配置
. /etc/profile
source /etc/profile
安装 kettle
1. 下载 kettle集成包
https://sourceforge.net/projects/pentaho/files/
2. 上传到服务器解压
# 解压
unzip pdi-ce-9.1.0.0-324.zip
# 创建 kettle 目录
mkdir /usr/local/kettle
# 移动到 kettle 目录
mv data-integration /usr/local/kettle
# 给 shell 脚本增加 执行权限
chmod +x /usr/local/kettle/data-integration/*.sh
# 启动 kettle,如果有帮助信息,表示 kettle 环境部署成功
cd /usr/local/kettle/data-integration
./kitchen.sh
# 有可能提示 waring
WARNING: no libwebkitgtk-1.0 detected, some features will be unavailable
Consider installing the package with apt-get or yum.
e.g. 'sudo apt-get install libwebkitgtk-1.0-0'
安装即可
# 再次启动 kitchen.sh, 查看 kettle 环境部署情况
ubuntu@VM-0-5-ubuntu:/usr/local/kettle/data-integration$ ./kitchen.sh
Options:
-rep = Repository name
-user = Repository username
-trustuser = !Kitchen.ComdLine.RepUsername!
-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)