[bigdata-007] Hortonworks HDF搭建流程

1. hdf docker搭建

1.1 hdf的镜像xemuliam/hdf
镜像链接 https://hub.docker.com/r/xemuliam/hdf/
下载镜像:
docker pull xemuliam/hdf

1.2 创建容器
docker run --name dck-hdf-8080 -p 8080:8080 -d xemuliam/hdf

1.3 进入容器bash交互
docker exec -it dck-oracle-11g /bin/sh

1.4 查看容器linux的发行版
cat /etc/issue
Welcome to Alpine Linux 3.4
Kernel \r on an \m (\l)


1.5 检查nifi是否运行
ps axu|grep -i nifi
能看到相关进程已经运行

1.6 nifi的运行启动文档
http://docs.hortonworks.com/HDPDocuments/HDF2/HDF-2.1.1/bk_dataflow-minifi-quick-start/content/ch_minifi-quick-start.html#overview

1.7 nifi的使用操作建模文档
http://nifi.apache.org/docs.html

1.8 容器启动后,由于它的端口8080已经做了映射,所以在浏览器地址栏输入http://127.0.0.1:8080/nifi,就能看到nifi的web主页面。


2 hdf用户指南文档
http://zh.hortonworks.com/products/data-center/hdf/


3. nifi的hello world,根据官网文档操作
3.1 拖一个processor到页面上,用local过滤,选择getFile。
    这个processor的作用是,把本地的文件上传给nifi,然后再删除掉本地文件。

3.2 nifi的home目录,是/opt/hdf,在这个目录下,创建子目录data-in

3.3 右击getFile,选择configure
    设置了input directory是data-in,那么,nifi就将这个目录里的数据上传到Nifi进行处理。

3.4 选择一个简单的处理方式,记录这个文件的属性,然后将属性发给nifi的log。
    在页面上添加一个logAttribute的processor。然后,将getFile的success事件设置到logAttribute里。

3.5 准备一下运行结果观察:
    在容器的命令行运行 tail -f /opt/hdf/logs/nifi-app.log

3.6 在nifi的web设计页面,点击运行。

3.7 在容器的/ope/hdf/data-in目录下,生成一个文件,比如
    touch readmexyz.txt
    生成后,ls一下,这个文件不存在,因为它一被创建,就被nifi上传到getFile processor进行处理,然后再删除本地文件。
    这时候,去看3.5里的log,出现如下字符串的文件属性,这是由logAttributes processor的输出,形如:
--------------------------------------------------
Standard FlowFile Attributes
Key: 'entryDate'
    Value: 'Tue Dec 20 07:33:34 GMT 2016'
Key: 'lineageStartDate'
    Value: 'Tue Dec 20 07:33:34 GMT 2016'
Key: 'fileSize'
    Value: '0'
FlowFile Attribute Map Content
Key: 'absolute.path'
    Value: '/opt/hdf/data-in-brian/'
Key: 'file.creationTime'
    Value: '2016-12-20T07:32:56+0000'
Key: 'file.group'
    Value: 'root'
Key: 'file.lastAccessTime'
    Value: '2016-12-20T07:33:34+0000'
Key: 'file.lastModifiedTime'
    Value: '2016-12-20T07:32:56+0000'
Key: 'file.owner'
    Value: 'root'
Key: 'file.permissions'
    Value: 'rw-r--r--'
Key: 'filename'
    Value: 'readmexyz.txt'
Key: 'path'
    Value: '/'
Key: 'uuid'
    Value: 'b659251f-dff6-4558-afa6-42a4fa9e61a0'
--------------------------------------------------
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值