当前位置:网站首页>Nifi 快速安装及文件同步操作
Nifi 快速安装及文件同步操作
2022-04-23 14:02:00 【百夜﹍悠ゼ】
Nifi简单来说是一个数据拉取、数据处理以及数据分发的系统。
Nifi运行需要JVM,需要jdk,nifi 1.x以上需要jdk8以上,0.x需要jdk7以上。
本文是在Centos 7中安装nifi-1.8.0-bin.tar.gz
下载地址:nifi.apache.org/download (xx.tar.gz 是Linux版本,xx.zip是Windows版本)
使用手册:http://nifi.apache.org/docs.html
安装
1.下载安装包
wget -b http://mirror.bit.edu.cn/apache/nifi/1.8.0/nifi-1.8.0-bin.tar.gz
2.解压安装包
tar -zxf nifi-1.8.0-bin.tar.gz
3.修改nifi/conf目录下nifi.properties文件
修改主机号和端口号
nifi.web.http.host=主机号
nifi.web.http.port=服务端口号[自定义]
# web properties #
nifi.web.war.directory=./lib
nifi.web.http.host=192.168.197.106 // 修改为自己主机ip
nifi.web.http.port=8182 // 默认8080,防止端口占用,可以修改为其他端口
nifi.web.http.network.interface.default=
nifi.web.https.host=
nifi.web.https.port=
nifi.web.https.network.interface.default=
nifi.web.jetty.working.directory=./work/jetty
nifi.web.jetty.threads=200
nifi.web.max.header.size=16 KB
nifi.web.proxy.context.path=
nifi.web.proxy.host=
4.服务启动
进入nifi/bin 目录,运行nifi.sh文件,前后台运行命令如下
./nifi.sh run //前台运行
./nifi.sh start //后台运行
出现如下提示即服务启动成功,
Java home: /opt/soft/jdk180
NiFi home: /opt/soft/nifi-1.8.0
Bootstrap Config File: /opt/soft/nifi-1.8.0/conf/bootstrap.conf
查看nifi启动状态
./nifi.sh stauts
-----------------------------------------------------------------------------------------------------------
Java home: /opt/soft/jdk180
NiFi home: /opt/soft/nifi-1.8.0
Bootstrap Config File: /opt/soft/nifi-1.8.0/conf/bootstrap.conf
2021-05-01 17:24:49,589 INFO [main] org.apache.nifi.bootstrap.Command Apache NiFi is currently running, listening to Bootstrap on port 43069, PID=2099
5.服务关闭
如果是前台运行,直接Ctrl+C 退出服务。
如果是后台运行,可进入nifi/bin目录,执行如下命令
./nifi.sh stop
6.web UI
服务启动1-5分钟后,可以打开web查看,http:192.168.197.106:8182/nifi,如图所示。
使用
文件同步
实现:将/opt/act.log 文件内容同步到/opt/data空目录下,且保留源文件。
需要处理器 GetFile (读取并删除文件) + PutFile(保存文件)
在工具栏中拖拽一个Processor进入画布,输入’local’,选择’GetFile’处理器,点击ADD添加到画布中,同样的操作创建一个’PutFile’处理器。
配置GetFile处理器
1.选中处理器,右击选择“configure”,“settings”中勾选“success”,自动终止关系。
2.“properties”属性配置。
- Input Directory:输入源目录
- File Filter:文件过滤器
- Keep Source File:是否保留源文件,默认false
- Recurse Subdirectories:是否拉取子目录中的文件,默认true
配置完毕后,点击‘apply’保存应用。
配置PutFile处理器
1.选中处理器,右击选择“configure”,在“settings”中勾选“failure”和“success”。
2.“properties”属性配置
- Directory:目标目录
- Conflict Resolution Strategy:指定存在同名文件后的操作。可选值:replace替换已有文件,fail执行失败,不生成文件,ignore忽视。
- Create Missing Directories:指定不存在目标目录是否创建目录。可选值:true新建,false不新建。
配置完毕后,点击‘apply’保存应用。
连接处理器
1.鼠标移动到’GetFile’上,出现如下箭头,点击拖拽到’PutFile’上。
2.配置“Settings”,设定name:demo1,增加优先级,‘FirstInFirstOutPrioritizer’。点击’add’,创建连接。
3.右击画布选择’Start‘,可见数据流通。GetFile 读取文件输出7.36KB,PutFile写入文件到目标目录中,7.36KB,同时在目标目录中可见act.log文件。
版权声明
本文为[百夜﹍悠ゼ]所创,转载请带上原文链接,感谢
https://blog.csdn.net/AlierSnow/article/details/116454058
边栏推荐
- 微信小程序与低功耗蓝牙通信-往硬件端发送数据(三)
- Neuron and neural network
- _模_板_
- 33 million IOPs, 39 microsecond delay, carbon footprint certification, who is serious?
- Autumn recruitment in 2021, salary ranking No
- go 语言 数组,字符串,切片
- Android interview theme collection
- visio安装报错 1:1935 2:{XXXXXXXX...
- smart-doc + torna生成接口文档
- Elmo (bilstm-crf + Elmo) (conll-2003 named entity recognition NER)
猜你喜欢
Quartus Prime硬件实验开发(DE2-115板)实验二功能可调综合计时器设计
Oracle告警日志alert.log和跟踪trace文件中文乱码显示
Business case | how to promote the activity of sports and health app users? It is enough to do these points well
基于Ocelot的gRpc网关
微信小程序调用客服接口
The art of automation
微信小程序的订阅号开发(消息推送)
第一章 电商秒杀商品回顾
3300万IOPS、39微秒延迟、碳足迹认证,谁在认真搞事情?
程序编译调试学习记录
随机推荐
centOS下mysql主从配置
New关键字的学习和总结
Quartus prime hardware experimental development (de2-115 board) experiment 1 CPU instruction calculator design
mysql新表,自增id长达20位,原因竟是......
神经元与神经网络
Autumn recruitment in 2021, salary ranking No
金蝶云星空API调用实践
Jiannanchun understood the word game
Port occupied 1
pthread_self()为何重复了
分页SQL
L2-024 部落 (25 分)
JS force deduction brush question 103 Zigzag sequence traversal of binary tree
微信小程序通过低功耗蓝牙设备进行定位及测距(二)
全局变量能否放在头文件中定义
1256: bouquet for algenon
China creates vast research infrastructure to support ambitious climate goals
Chapter 15 new technologies of software engineering
PySide2
烟雾传感器(mq-2)使用详细教程(基于树莓派3b+实现)