1. 准备工作

一个简单的job,一个简单的trans。

trans:读取download目录下的所有文件名,输出为文件。【界面情况下测试成功】 

成功生成目标文件: 

job:创建文件。【界面模式测试执行成功】 

执行结果: 

把界面执行测试结果文件删除,以免影响观察。

2. linux环境以命令行方式执行job和trans

    Pan是用于执行trans的PDI命令行工具。
Kitchen是用于执行作业的PDI命令行工具。
  • 1
  • 2

a. Pan的命令行选项和语法 
语法:

        pan.sh -option=value arg1 arg2
  • 1

命令行参数:

Switch Purpose
rep Enterprise or database repository name, if you are using one
user Repository username
pass Repository password
trans The name of the transformation (as it appears in the repository) to launch
dir The repository directory that contains the transformation, including the leading slash
file If you are calling a local KTR file, this is the filename, including the path if it is not in the local directory
level The logging level (Basic, Detailed, Debug, Rowlevel, Error, Nothing)
logfile A local filename to write log output to
listdir Lists the directories in the specified repository
listtrans Lists the transformations in the specified repository directory
listrep Lists the available repositories
exprep Exports all repository objects to one XML file
norep Prevents Pan from logging into a repository. If you have set the KETTLE_REPOSITORY, KETTLE_USER, and KETTLE_PASSWORD environment variables, then this option will enable you to prevent Pan from logging into the specified repository, assuming you would like to execute a local KTR file instead.
safemode Runs in safe mode, which enables extra checking
version Shows the version, revision, and build date
param Set a named parameter in a name=value format. For example: -param:FOO=bar
listparam List information about the defined named parameters in the specified transformation.
maxloglines The maximum number of log lines that are kept internally by PDI. Set to 0 to keep all rows (default)
maxlogtimeout The maximum age (in minutes) of a log line while being kept internally by PDI. Set to 0 to keep all rows indefinitely (default)

示例:

    sh pan.sh -rep=initech_pdi_repo -user=pgibbons -pass=lumburghsux -trans=TPS_reports_2011
  • 1

本地trans调用示例:

./pan.sh -file=/home/hadoop/workplace/kettle/trans/test_cml.ktr -norep
  • 1

b.Kitchen的命令行参数及语法:

语法与Pan一样,参数有点不同。

Switch urpose
rep Enterprise or database repository name, if you are using one
user Repository username
pass Repository password
job The name of the job (as it appears in the repository) to launch
dir The repository directory that contains the job, including the leading slash
file If you are calling a local KJB file, this is the filename, including the path if it is not in the local directory
level The logging level (Basic, Detailed, Debug, Rowlevel, Error, Nothing)
logfile A local filename to write log output to
listdir Lists the sub-directories within the specified repository directory
listjob Lists the jobs in the specified repository directory
listrep Lists the available repositories
export Exports all linked resources of the specified job. The argument is the name of a ZIP file.
norep Prevents Kitchen from logging into a repository. If you have set the KETTLE_REPOSITORY, KETTLE_USER, and KETTLE_PASSWORD environment variables, then this option will enable you to prevent Kitchen from logging into the specified repository, assuming you would like to execute a local KTR file instead.
version Shows the version, revision, and build date
param Set a named parameter in a name=value format. For example: -param:FOO=bar
listparam List information about the defined named parameters in the specified job.
maxloglines The maximum number of log lines that are kept internally by PDI. Set to 0 to keep all rows (default)
maxlogtimeout The maximum age (in minutes) of a log line while being kept internally by PDI. Set to 0 to keep all rows indefinitely (default)

执行本地job的命令行语句:

    /home/kettle/data-integration/kitchen.sh -file=/home/kettle/transition/move.kjb -log=log.log
  • 1

形式:

    $kitchen路径 -file=$job路径 log=$log路径
  • 1

调用pan结果: 

调用kitchen结果: 

3.个人常用命令选项

由于我当前的工作环境都是执行本地的job和trans文件,所以常用的命令选项有:

命令 描述
-file job或trans文件路径
-norep 标明不是资源库里的文件
-param 参数设置
-logfile log输出文件名
-level log级别 (Basic, Detailed, Debug, Rowlevel, Error, Nothing)

Linux下用命令来执行kettle文件资源库的文件ktr与kjb的方法的更多相关文章

  1. linux下rm命令删除文件名中包含特殊字符的文件【转】

    转自:http://blog.itpub.net/143526/viewspace-1060083/ 1. 删除带“-”的文件名的方法 2. 删除包含其它特殊字符的文件 3. 删除系统打不出的乱码文件 ...

  2. Linux下pecl命令无法执行的解决

    pecl install swoole 提示如下错误:bash: pecl: command not found执行yum install php-pear生效

  3. linux下svn命令使用大全

    最近经常使用svn进行代码管理,这些命令老是记不住,得经常上网查,终于找了一个linux下svn命令使用大全:1.将文件checkout到本地目录 svn checkout path(path是服务器 ...

  4. [转载]linux下svn命令使用大全

    原文地址:http://blog.chinaunix.net/uid-22150747-id-189264.html 最近经常使用svn进行代码管理,这些命令老是记不住,得经常上网查,终于找了一个li ...

  5. Linux下scp命令使用

    linux下scp命令主要是用来远程拷贝文件,下面介绍两种使用方法 1,拷贝本机文件到远程文件 举例子:把我本地的change目录下的changeFile.txt上传到远程192.168.2.88的k ...

  6. LINUX学习笔记——LINUX下EXP命令全库备份数据库文件

    LINUX下EXP命令全库备份数据库文件 1)建立备份目录,目录操作权限授权给Oracle用户 mkdir /backup  --创建backup文件夹 cd  /   --进入cd语句 ls  -l ...

  7. Linux下的命令,删除文件夹下的所有文件,而不删除文件夹本身

    Linux下的命令,删除文件夹下的所有文件,而不删除文件夹本身 rm -rf *

  8. 在Linux下使用命令行打印文件

    近期需要将数学笔记打印出来复习,才发现Linux KDE环境下的默认PDF软件Okular根本无法将我在GoodNotes B5大小的页面写下的内容自适应地放大到A4纸上,只能以页面的原始尺寸打印.然 ...

  9. 例解 Linux 下 Make 命令

    Linux 下 make 命令是系统管理员和程序员用的最频繁的命令之一.管理员用它通过命令行来编译和安装很多开源的工具,程序员用它来管理他们大型复杂的项目编译问题.本文我们将用一些实例来讨论 make ...

随机推荐

  1. oracle取前10条记录

    --oracle取前十条数据 --(1)第一种 ; --(2)第二种 ;

  2. 启动项目报错:Unsupported major.minor version 52.0

    解决方案: 确保Build Path或者电脑配置的环境变量版本号,和pom中的一致 Exception in thread "main" java.lang.Unsupported ...

  3. XAMPP+TestLink

    XAMPP(Apache+MySQL+PHP+PERL)是一个功能强大的建站集成软件包.这个软件包原来的名字是 LAMPP,但是为了避免误解,最新的几个版本就改名为 XAMPP 了.它可以在Windo ...

  4. python 设计模式之工厂模式 Factory Pattern (简单工厂模式,工厂方法模式,抽象工厂模式)

    十一回了趟老家,十一前工作一大堆忙成了狗,十一回来后又积累了一大堆又 忙成了狗,今天刚好抽了一点空开始写工厂方法模式 我看了<Head First 设计模式>P109--P133 这25页 ...

  5. vim脚本判断操作系统

    Linux 和 Windows 通用配置 其实在配置文件中是可以通过逻辑代码判断平台做条件处理的,这样就可以实现一个配置文件两个个平台下共用了,判断逻辑如下: " ============= ...

  6. 002 elasticsearch中的一些概念

    在本文中,主要是ES7中的核心概念. ElasticSearch是一个实时分布式开源全文搜索和分析引擎.它可以从RESTful网络服务接口访问,并使用无模式JSON (JavaScript对象符号)文 ...

  7. typescript属性类型接口

    /* typeScript中的接口 - 1.属性类接口 */ /* 接口的作用:在面向对象的编程中,接口是一种规范的定义,它定义了行为和动作的规范,在程序设计里面,接口起到一种限制和规范的作用.接口定 ...

  8. shell编程系列1--shell脚本中的变量替换

    shell编程系列1--shell脚本中的变量替换 变量替换总结: .${变量#匹配规则} # 从头开始匹配,最短删除 .${变量##匹配规则} # 从头开始匹配,最长删除(贪婪模式) .${变量%匹 ...

  9. opencv4 mask_rcnn模型调(c++)

    昨天有人问我关于调用mask_rcnn模型的问题,忽然想到最近三个月都没用opencv调用训练好的mask_rcnn模型了,今晚做个尝试,所以重新编译了 opencv4,跑个案例试试 #include ...

  10. 【笔记】第六章、Linux 的文件权限与目录配置

    Linux的每个文件中,依据权限分为使用者.群组与其他人三种身份: 群组最有用的功能之一,就是当你在团队开发资源的时候,且每个账号都可以有多个群组的支持: 利用ls -l显示的文件属性中,第一个字段是 ...