Kettle(水壺)是開源的ETL(數據抽取Extract、轉換Transform、加載Load)工具,數據抽取和轉換工具。Java編寫,可在Windows、Linux、Unix上運行,支持各類數據類型放到水壺裏。以一種指定的格式流出,ETL工具容許來自不一樣的數據庫的數據,經過圖形化用戶環境來描述。java
Kettle有兩種腳本文件,transformation和job,transformation完成數據基礎轉換,job完成整個工做流控制。sql
Kettle有三個主要組件:Spoon、Kitchen、Pan數據庫
Kettle安裝部署,將Mysql數據經過Kettle寫入分析型數據庫(ADS),設置定時任務crontab方式,定時Mysql數據 => ADS。vim
vim /etc/profile.d/java.sh JAVA_HOME=/usr/java/jdk1.8.0_25 PATH=$JAVA_HOME/bin:$PATH:$HOME/.local/bin:$HOME/bin export PATH
驗證: java -versionwindows
部署kettle
下載:https://community.hitachivantara.com/docs/DOC-1009855?spm=a2c4g.11186623.2.4.zMdWMo
解壓:ll /data/kettle/data-integration
驗證kettle:/data/kettle/data-integration/kitchen.sh
出現幫助信息爲正確,如圖:
bash
創建做業和轉化
創建目錄: mkdir -p /data/kettle/kettle-job
將windows中建好的做業(.kjb)和轉化(.ktr)文件放入/data/kettle/kettle-job文件夾中
並將.kjb文件中windows的轉換路徑修改成Linux路徑。ide
#data center crond 0 1 * * * /bin/bash /data/kettle/kettle-job-ads/start.sh >> /data/kettle/kettle-job-ads/kettle.log 2>&1 0 2 * * * /bin/bash /data/kettle/kettle-job-ads/start-s.sh >> /data/kettle/kettle-job-ads/kettle1.log 2>&1
查看/data/kettle/kettle-job-ads/start-s.sh中執行的job做業。
cat /data/kettle/kettle-job-ads/start-s.sh工具
/data/kettle/data-integration/kitchen.sh -file=/data/kettle/kettle-job-ads/da_area_job.kjb -level=Detailed -logfile=/data/kettle/kettle-job-ads/logs/kettle-area.log sleep 5 /data/kettle/data-integration/kitchen.sh -file=/data/kettle/kettle-job-ads/da_brand_job.kjb -level=Detailed -logfile=/data/kettle/kettle-job-ads/logs/kettle-brand.log sleep 5 /data/kettle/data-integration/kitchen.sh -file=/data/kettle/kettle-job-ads/da_order_item_job.kjb -level=Detailed -logfile=/data/kettle/kettle-job-ads/logs/kettle-order-item.log sleep 5; /data/kettle/data-integration/kitchen.sh -file=/data/kettle/kettle-job-ads/da_order_job.kjb -level=Detailed -logfile=/data/kettle/kettle-job-ads/logs/kettle-order-job.log sleep 5 /data/kettle/data-integration/kitchen.sh -file=/data/kettle/kettle-job-ads/da_product_category.kjb -level=Detailed -logfile=/data/kettle/kettle-job-ads/logs/kettle-category.log sleep 5 /data/kettle/data-integration/kitchen.sh -file=/data/kettle/kettle-job-ads/da_product_job.kjb -level=Detailed -logfile=/data/kettle/kettle-job-ads/logs/kettle-product.log