背景
须要从 Kafka 0.8.x 版本订阅音讯, 而后发送音讯到 Kafka 1.0.x 版本中, 其中波及到了 Kafka 版本抵触的问题, NiFi 很好的解决了这个问题
NiFi 开发人员指南 NiFi Archives (NARs) 章节中有如下阐明
When software from many different organizations is all hosted within the same environment, Java ClassLoaders quickly become a concern. If multiple components have a dependency on the same library but each depends on a different version, many problems arise, typically resulting in unexpected behavior or NoClassDefFoundError errors occurring. In order to prevent these issues from becoming problematic, NiFi introduces the notion of a NiFi Archive, or NAR.
阐明 NiFi 通过将依赖打入 NAR 包, 且不同 NAR 包的 ClassLoader 互相隔离, 而后不同版本的处理器应用不同的 NAR 包, 隔离了依赖, 解决了依赖抵触问题
然而目前应用的 NiFi 1.11.4 版本中, 没有找到 Kafka 8.0.x 相干处理器, 最低反对 Kafka 0.9.x
寻找解决方案
NiFi.rocks 中发现, Nifi 1.10.0 版本中 PutKafka 和 GetKafka 处理器隐没了
NiFi 发行阐明 中有以下阐明
Please note several components that were bundled by default are no longer included due to space limitations. Please see Migration Guidance specifically for moving to 1.10.x.
阐明因为空间限度,有几个默认捆绑的组件在 NiFi 1.10.x 版本的软件包不再默认捆绑, 从 迁徙指南 中能够获取到更具体的阐明
NiFi 迁徙指南 中有以下阐明
Migrating from 1.x.x to 1.10.0
We’ve removed the following nars from the default convenience binary. These include kite-nar, kafka-0-8-nar, flume-nar, media-nar, druid-controller-service-api-nar, druid-nar, other-graph-services-nar. You can still get them from the various artifact repositories and use them in your flows but we cannot bundle them due to space limitations by default.
阐明因为空间限度, kafka-0-8-nar 曾经从默认的二进制文件包中删除, 然而能够从 Artifact 仓库获取应用
解决方案
获取 kafka-0-8-nar NAR 包, 放到 NiFi 装置目录下
操作步骤
- 获取 nifi-kafka-0-8-nar-1.11.4.nar, 有两种计划
a. 从 Maven 仓库 下载对应版本的nifi-kafka-0-8-nar
NAR 包
b. 从源码编译, 编译nifi-nar-bundles/nifi-kafka-bundle
模块, 找到nifi-nar-bundles/nifi-kafka-bundle/nifi-kafka-0-8-nar/target/nifi-kafka-0-8-nar-1.11.4.nar
- 将 NAR 包放到 NiFi 装置目录的
lib
目录下, 重启 NiFi, 而后咱们失去了 Kafka 0.8.x 相干处理器