kettle etl mysql to hive/to hdfs
1.使用kettle 连接mysql导出数据到hive
添加 mysql connection
database connection右键-->new
添加 hive connection
database connection右键-->new
创建 table input和table output
table input关联mysql connection
table putput关联hive connection
建立input到output的箭头(选中后shift箭拖动)
填入表名称(可以是不存在的,会自动新建),点击SQL
点击执行
hue中查看hive 中表kettle-test中有数据了,导入成功。
2.使用kettle 连接mysql导出数据到hdfs
添加 mysql connection
需要先拷贝mysql的jdbc连接驱动到kettle的目录:
C:\data-integration\plugins\pentaho-big-data-plugin\hadoop-configurations\cdh61\lib\pmr
C:\data-integration\lib
添加hadoop cluster 连接
hadoop cluster右键-->add driver
点击browser,选择合适的版本,我的CDH是6.3.2,这儿选择cdh61也可以
hadoop cluster右键-->new cluster
先将CDH的配置文件下载拷贝到kettle目录
登录cloudera management-->HDFS-->Action -->Download Client Configuration
解压配置文件拷贝hdfs-site.xml和core-site.xml到C:\data-integration\plugins\pentaho-big-data-plugin\hadoop-configurations\cdh61中去
hadoop cluster右键-->new cluster
IP填真实地址,密码可以不填,端口不要变,是固定的。
点击next
view result
得到下面结果即可,其他报错不影响使用
创建下面流程的组件
table input -->edit
hadoop output-->edit
点击table input按住shift按键拖动到hadoop output,形成箭头
点击run即可看见成功信息
查看HDFS生成文件: