kettle定时调度

简单版:

https://blog.csdn.net/hzp666/article/details/107841754

 

详细版:

1.场景介绍:
根据不同的操作系统定时调度kettle资源库中的job

1.1Windows系统的定时调度:

我的是 version7.1

如上图,在kettle里面的作业已经执行成功。

一、首先编写kettle.bat脚本:(kitchen.bat  后面可以是-也可以是/然后再加options,而options 后面可以是=也可以是:也可以是空格

 D:
cd D:\kettle\pdi-ce-7.1.0.0-12\data-integration
kitchen.bat -rep=product -user=admin -pass=admin -dir=/ -job=人才生产线job -level=basic>D:\kettle\JOB.log

顺便解释一下:

1、首先cd 是进入到kettle安装执行文件目录下 
       -rep 表示的是你的仓库名,也就是你的资源库的名称,这里我的资源库名称就是 JS_JOB
       -user 资源库用户名    这里就是admin
      -pass 资源库密码        这里是qdhuang 默认的是admin ,为了安全我们可以更改密码
      -dir    就是你的job在资源库中存放目录  支持中文的目录
      -job   job的名称   这里我的job名称就是jobname(job名字不要带后缀,不然提示找不到job错误)
      -level 日志的级别  我们普通的写basic就可以了,就是最基本的
      最后面就是日志了,针对job跑起来的相关信息都会保存在job.log中
2、针对相关的更多参数如下(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.

注意:

保存kitchen.bat文件时,刚开始选的编码是utf8,此时中文乱码(后改为Unicode也是乱码),最后改为ANSI就可以了。

二、完成bat脚本以后,双击测试一下,会跳出cmd命令窗口,此时打开JOB.log日志记录,会发现已经在执行作业了,等待完成以后,cmd窗口会自动关闭。接下来就是Windows的定时任务来管理调度bat脚本了。

三、windows下建立执行任务(我的服务器是Windows Server 2016 Datacenter)

打开控制面板--管理工具--任务计划程序

打开右侧的创建基本任务,填写作业名称,然后下一步打开触发器:

打开触发器,根据自己的需求选择执行频率,然后下一步打开具体的设置:

 

打开操作,下一步打开具体设置(选择需要执行的bat脚本),下一步完成:

 

至此,Windows计划任务调度kettle作业完成。

二:linux环境crond定时任务执行kettle资源库中的job
linux环境定时调度任务主要用crond
1、先手动执行定时任务以此来判断脚本是否有问题。
手动调job没有问题:
在这里插入图片描述
2、确认服务器是否开启定时任务计划服务
命令:service crond status
启动命令:service crond start
在这里插入图片描述
3.设置定时任务:
12 17 * * * /data/data-integration/kitchen.sh -rep=xforceplus -job=sj_sjzc_job -dir=/Hades/ETL/OTHER_DATA>/root/cron.log
在这里插入图片描述
4.17:12查看定时任务结果
a.17:12程序启动成功
在这里插入图片描述
b.文件成功生成
在这里插入图片描述
三.kettle更多参数介绍
在这里插入图片描述
在这里插入图片描述
kettle更多参数如下:
/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 =. 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

crontab更多设置可参考:Linux定时任务Crontab命令详解
更多ketlle视频资料下载地址:kettle视频资料

  • 2
    点赞
  • 34
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值