window系统下调度数据库类型资源库中的kettle job

浏览: 2664

已经存在kettle的一个资源库enfo,在目录/works/wxj下面有一个job (testmailsuccess.kjb)如何实现手工在kettle外部执行此job和让系统每天定时的调用此job.

(1)先说手工调用:

进入cmd

C:\Users\Administrator>E:--切换到kettle所在解压盘

E:\>cd pdi-ce-4.2.0-stable\data-integration--切换到解压目录

E:\pdi-ce-4.2.0-stable\data-integration>kitchen.bat -rep enfo -user wxj -pass wxj1988 -dir /works/wxj -job testmailsuccess--执行命令

效果如下:

同时发出邮件通知:

命令也可以替换为:用下面的方式,执行日志写入指定的目录文件中:
E:\pdi-ce-4.2.0-stable\data-integration>kitchen.bat -rep enfo -user wxj -pass wxj1988 -dir /works/wxj -job testmailsuccess -level=basic>d:

\kettlelog\a.log

日志和控制台显示的一样如图

(2):系统调度kettle job

 利用window下的任务计划调用批处理命令,即.bat批处理命令,在d盘中创建了一个testjob.bat

 内容如下:

----------------------------------------------------------------------------------------------------------------------------------

e:
cd pdi-ce-4.2.0-stable\data-integration 
kitchen.bat -rep enfo -user wxj -pass wxj1988 -dir /works/wxj -job testmailsuccess -level=basic>d:\kettlelog\testmailsuccess1.log

-----------------------------------------------------------------------------------------------------------------------------------

双击testjob.bat执行效果

说明执行此批处理文件就可以起到执行此job的效果,接下来让系统定时的执行此批处理命令,就起到了定时调度kettle job的作用。

找到系统的任务计划,创建任务:

1:填写名称和描述,下一步

2:指定执行频率,下一步

3:指定每天执行的时间点,下一步

4:选择启动程序即可,下一步

5:选择批处理文件所在目录,下一步

6任务创建完成,看任务列表

OK,保证服务器在运行的情况下,任务和计划就会每天定时的执行批处理文件,起到调度ETL程序的作用。

推荐 1
本文由 kingwang 创作,采用 知识共享署名-相同方式共享 3.0 中国大陆许可协议 进行许可。
转载、引用前需联系作者,并署名作者且注明文章出处。
本站文章版权归原作者及原出处所有 。内容为作者个人观点, 并不代表本站赞同其观点和对其真实性负责。本站是一个个人学习交流的平台,并不用于任何商业目的,如果有任何问题,请及时联系我们,我们将根据著作权人的要求,立即更正或者删除有关内容。本站拥有对此声明的最终解释权。

3 个评论

E:\pdi-ce-4.2.0-stable\data-integration>kitchen.bat -rep enfo -user wxj -pass wxj1988 -dir /works/wxj -job

请问如果我用的是文件型资源库 -rep 这个是不是应该换成别的命令?
这个是肯定的啊,看下面的

kitchen.bat /norep -file=D:/kettledata/mysal2orcle.kjb >> kitchen_%date:~0,10%.log

kitchen.bat 后面可以是-也可以是/然后再加options
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.
多谢,已经解决问题,回复收藏了

要回复文章请先登录注册