写在前面
本文看下如何安装nifi。
1:准备
你需要准备如下内容:
linux环境
nifi安装包(这里使用2.0.0版本了)
下载地址:https://mirrors.aliyun.com/apache/nifi/2.0.0/?spm=a2c6h.25603864.0.0.3e0b41d4KnvASx
jdk(使用21版本)
下载地址:https://mirrors.tuna.tsinghua.edu.cn/Adoptium/21/jdk/x64/linux
2;安装
2.1:单机版(http)
- 解压
unzip nifi-2.0.0-bin.zip -d /opt/study/
mv nifi-2.0.0-bin nifi -->这里步骤非必须,只是为了操作方便,将版本号去掉了
- 修改配置
关闭https:
[root@localhost conf]# grep "remote.input.secure" nifi.properties
nifi.remote.input.secure=false -》这里默认是true,改为false
配置http端口号,去掉https端口号(不去掉会报同时设置https和http的错误):
- 关闭防火墙(简单粗暴,标准做法是开放特定端口)
systemctl status firewalld.service
systemctl stop firewalld.service
systemctl status firewalld.service
systemctl disable firewalld.service
使用vim /etc/sysconfig/selinux,将SELINUX=enforcing改为SELINUX=disabled。
最后重启。 -->别忘了这个步骤
如下是开放指定端口(我没试过,应该没问题):
# 查看已开放的所有端口
firewall-cmd --list-ports
# 开放8443
firewall-cmd --permanent --zone=public --add-port=8443/tcp
# 重新加载防火墙规则,使更改生效
firewall-cmd --reload
- 启动并访问
[root@localhost conf]# /opt/study/nifi/bin/nifi.sh start
JAVA_HOME=/usr/local/jdk-21
NIFI_HOME=/opt/study/nifi
[root@localhost conf]# tail -f /opt/study/nifi/logs/nifi-*
==> /opt/study/nifi/logs/nifi-app_2025-03-10_05.0.log <==
2025-03-10 05:58:58,180 INFO [Checkpoint FlowFile Repository] o.a.n.c.r.WriteAheadFlowFileRepository Initiating checkpoint of FlowFile Repository
...
访问http://192.168.10.23:9211/nifi
:
因为是http方式的,所以直接就进来了,并不需要登录。
2.2:单机版(https)
TODO
2.3:集群版(http)
TODO
2.4:集群版(https)
TODO
2.5:要注意的小点
2.5.1:关于Java环境配置
一般我们会配置在/etc/profile
文件中,但是这样会影响到整个系统,万一其他应用需要Java环境,但是是其他的版本怎么办呢?是吧,所以我们可以将jdk配置到nifi的启动脚本的最开始位置进行配置,从而做到只给自己使用的目的,减少影响范围,如下: