kettle使用命令行来运行job和transform

来源:互联网 发布:淘宝漏洞零元买东西 编辑:程序博客网 时间:2024/05/16 02:05
[Author]: ipple

1:cmd方式运行


1.ktr的运行:运行transformation文件是通过Pan.bat来运行的。
打开cmd命令行窗口,转到Pan.bat所在的目录,如d:\data-integration,然后执行文件的命令为:pan /file D:\etltest\EtltestTrans.ktr
2.kjb的运行:运行job文件是通过kitchen.bat来运行的。
打开cmd命令行窗口,转到Pan.bat所在的目录,如d:\data-integration,然后执行文件的命令为:kitchen /file D:\etltest\jobOK.kjb
2.bat文件运行
如果觉得通过打开命令行输入麻烦,我们可以把它写在一个批处理文件中。如:
d:
cd D:\data-integration
pan /file D:\etltest\EtltestTrans.ktr
把这些内容保存在pan.bat里,通过双击panKtr.bat就可以执行ktr文件了。
同样地,我们把下面的内容:
d:
cd D:\data-integration
kitchen /file D:\etltest\jobOK.kjb
保存在kitchenKjb.bat里,双击它,也可以执行kjb文件。
2 :kettle 的 kitchen.bat 后面参数说明

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, 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:FOO=bar
/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.

而options 后面可以是=也可以是:也可以是空格
kitchen.bat /file d:\   或者 -file=D:\ 或者/file:D:\
下面是windows系统下一个完整的执行kettle程序的 bat 批处理文件的内容
======================================
e:
cd E:\Tools\data-integration
Kitchen.bat -rep repname -user admin -pass admin -dir /dirname -job jobname -level=basic>D:\kettlelog\kettlelog.log
 
======================================
  

--命令行执行转换

[sql]view plaincopyprint?
  1. pan /rep etl /user admin /pass admin /trans 业务报装+记录排序  
--详细参数
[sql]view plaincopyprint?
  1. C:\Users\gyh>pan  
  2. DEBUG: Using JAVA_HOME  
  3. DEBUG: _PENTAHO_JAVA_HOME=D:\Program Files\Java\jdk1.6.0_33  
  4. DEBUG: _PENTAHO_JAVA=D:\Program Files\Java\jdk1.6.0_33\bin\java.exe  
  5. Options:  
  6.   /rep            : 资源库名称  
  7.   /user           : 资源库用户名  
  8.   /pass           : 资源库密码  
  9.   /trans          : 要启动的转换名称  
  10.   /dir            : 目录(不要忘了前缀 /)  
  11.   /file           : 要启动的文件名(转换所在的 XML 文件)  
  12.   /level          : 日志等级 (基本, 详细, 调试, 行级, 错误, 没有)  
  13.   /logfile        : 要写入的日志文件  
  14.   /listdir        : 列出资源库里的目录  
  15.   /listtrans      : 列出指定目录下的转换  
  16.   /listrep        : 列出可用资源库  
  17.   /exprep         : 将资源库里的所有对象导出到 XML 文件中  
  18.   /norep          : 不要将日志写到资源库中  
  19.   /safemode       : 安全模式下运行: 有额外的检查  
  20.   /version        : 显示版本,校订和构建日期  
  21.   /param          : Set a named parameter <NAME>=<VALUE>. For example -param:FOO=bar  
  22.   /listparam      : List information concerning the defined named parameters inthe specified transformation.  
  23.   /maxloglines    : The maximum number of log lines that are kept internally by Kettle. Set to 0 to keep all rows (default)  
  24.   /maxlogtimeout  : The maximum age (in minutes) of a log line while being kept   
  25.             internally by Kettle. Set to 0 to keep all rows indefinitely (default)  


record of exercise
1 command 调用转换文件
d: 
cd D:\server\data-integration
pan /file D:\DWBI\ipple\kettle\t_test_rep_mysql.ktr

2 command 调用资料库转换
d:
cd D:\server\data-integration
pan.bat -rep r_10130216_test_zhouwangjin -user admin -pass admin -dir / -trans t_test_rep_mysql -level=basic>D:\DWBI\ipple\kettle\kettlelog20150921.log


3 command调用资料库job
d:
cd D:\server\data-integration
 Kitchen.bat -rep r_10130216_test_zhouwangjin -user admin -pass admin -dir / -job job_test_ipple -level=basic>D:\DWBI\ipple\kettle\kettlelog20150921_job_test_ipple.log 

0 0
原创粉丝点击