kettle linux自动,kettle系列之四 linux下使用kettle执行和调度

在linux环境下使用kettle

安装JDK1.8以上

版本要求git

vi Spoon.batgithub

d0239092cc1d5c8cc798801a09833fb1.png

安装PDI

参考spring

直接解压便可bash

[root@localhost data-integration]# pwd

/opt/kettle/data-integration

[root@localhost data-integration]#

执行做业

通常用kitchen.sh便可,转换建议包裹一个做业async

数据库资源库执行的命令,注意要指定目录和做业名称.net

./kitchen.sh -rep=192.168.137.1 -user=admin -pass=admin -dir="/lotestasync" -listjobs

./kitchen.sh -rep=192.168.137.1 -user=admin -pass=admin -dir="/lotestasync" -job="test1"

加入定时执行

kettle任务配置是支持定时执行的,可是这样的问题在于kettle应用程序会一直停留在前台,会致使内存溢出等问题rest

因此建议使用linux的crontab或者spring quartz定时器日志

演示crontab的例子:

定时执行的脚本

必须加source,定时任务不识别环境变量

日志文件10MB以后新建一个

[root@localhost .kettle]# cat cron_test1.sh

#!/bin/sh

source ~/.bash_profile

source /etc/profile

filename=/root/.kettle/test.log

filesize=`ls -l $filename | awk '{ print $5 }'`

maxsize=$((1024*1024*10))

if [ $filesize -gt $maxsize ]

then

mv /root/.kettle/test.log /root/.kettle/test"`date +%Y-%m-%d_%H:%M:%S`".log

fi

/opt/kettle/data-integration/kitchen.sh -rep=192.168.137.1 -user=admin -pass=admin -dir="/lotestasync" -job="test1" -level=Rowlevel>>/root/.kettle/test.log

使用crontab - 每分钟执行

[root@localhost .kettle]# crontab -l

*/1 * * * * /root/.kettle/cron_test1.sh

[root@localhost .kettle]#

重启服务

service crond restart

若是是写入数据库的日志,就要在做业中配置数据库日志连接

ecda8e4c4abdfcc48fa93780a80ec444.png

f3d83dedc0e03ebd51ee9624c064b9ff.png

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值