本章介绍NIFI组件的使用。

  主要有:Nginx反向代理NIFI,配置SSLContextService

Nginx反向代理NIFI

  使用nginx反向代理NIFI配置如下

 upstream nifi_server {
ip_hash;
server 127.0.0.1:18002;
} server {
listen 80;
server_name nifi.example.com;
charset utf-8; location / {
proxy_pass http://nifi_server; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-ProxyScheme http;
proxy_set_header X-ProxyHost nifi.example.com
proxy_set_header X-ProxyPort 80;
proxy_set_header X-ProxyContextPath /;
}
}

配置SSLContextService

  SSLContextService,可以用来发送https请求

  SSL Context Service实例配置信任库属性: 

    • Truststore文件名:Java安装中的cacerts文件

      • 如果在您的系统上设置了$JAVA_HOME,它应该有助于指向正确的方向。如果不是,cacerts的位置根据环境而变化,但是对于它们各自的OS大致如下

        • OS X: /Library/Java/JavaVirtualMachines/jdk<version>.jdk/Contents/Home/jre/lib/security/cacerts
        • Windows:C:\Program Files\Java\jdk <version>\jre\lib\security\ cacerts
        • Linux:/usr/local/java-<version>/jre/lib/security/cacerts
    • Truststore类型:JKS
    • Truststore密码:如果您使用的是默认Java密钥库,则默认密码为"changeit"

  案例

    GetHTTP

    

    StandardSSLContextService

    

  模版

 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<template encoding-version="1.2">
<description></description>
<groupId>620351d1-0168-1000-78a0-bf68b5b23177</groupId>
<name>Https-Demo</name>
<snippet>
<connections>
<id>c27e6613-7e35-3d9c-0000-000000000000</id>
<parentGroupId>25bb3a09-a84a-3df9-0000-000000000000</parentGroupId>
<backPressureDataSizeThreshold>1 GB</backPressureDataSizeThreshold>
<backPressureObjectThreshold>10000</backPressureObjectThreshold>
<destination>
<groupId>25bb3a09-a84a-3df9-0000-000000000000</groupId>
<id>a557eeeb-009b-316d-0000-000000000000</id>
<type>PROCESSOR</type>
</destination>
<flowFileExpiration>0 sec</flowFileExpiration>
<labelIndex>1</labelIndex>
<loadBalanceCompression>DO_NOT_COMPRESS</loadBalanceCompression>
<loadBalancePartitionAttribute></loadBalancePartitionAttribute>
<loadBalanceStatus>LOAD_BALANCE_NOT_CONFIGURED</loadBalanceStatus>
<loadBalanceStrategy>DO_NOT_LOAD_BALANCE</loadBalanceStrategy>
<name></name>
<selectedRelationships>success</selectedRelationships>
<source>
<groupId>25bb3a09-a84a-3df9-0000-000000000000</groupId>
<id>e132b9d2-4ae9-3941-0000-000000000000</id>
<type>PROCESSOR</type>
</source>
<zIndex>0</zIndex>
</connections>
<controllerServices>
<id>43bd3854-302f-30dd-0000-000000000000</id>
<parentGroupId>25bb3a09-a84a-3df9-0000-000000000000</parentGroupId>
<bundle>
<artifact>nifi-ssl-context-service-nar</artifact>
<group>org.apache.nifi</group>
<version>1.8.0</version>
</bundle>
<comments></comments>
<descriptors>
<entry>
<key>Keystore Filename</key>
<value>
<name>Keystore Filename</name>
</value>
</entry>
<entry>
<key>Keystore Password</key>
<value>
<name>Keystore Password</name>
</value>
</entry>
<entry>
<key>key-password</key>
<value>
<name>key-password</name>
</value>
</entry>
<entry>
<key>Keystore Type</key>
<value>
<name>Keystore Type</name>
</value>
</entry>
<entry>
<key>Truststore Filename</key>
<value>
<name>Truststore Filename</name>
</value>
</entry>
<entry>
<key>Truststore Password</key>
<value>
<name>Truststore Password</name>
</value>
</entry>
<entry>
<key>Truststore Type</key>
<value>
<name>Truststore Type</name>
</value>
</entry>
<entry>
<key>SSL Protocol</key>
<value>
<name>SSL Protocol</name>
</value>
</entry>
</descriptors>
<name>StandardSSLContextService</name>
<persistsState>false</persistsState>
<properties>
<entry>
<key>Keystore Filename</key>
</entry>
<entry>
<key>Keystore Password</key>
</entry>
<entry>
<key>key-password</key>
</entry>
<entry>
<key>Keystore Type</key>
</entry>
<entry>
<key>Truststore Filename</key>
<value>/data/soft/jdk1.8.0_181/jre/lib/security/cacerts</value>
</entry>
<entry>
<key>Truststore Password</key>
</entry>
<entry>
<key>Truststore Type</key>
<value>JKS</value>
</entry>
<entry>
<key>SSL Protocol</key>
</entry>
</properties>
<state>ENABLED</state>
<type>org.apache.nifi.ssl.StandardSSLContextService</type>
</controllerServices>
<processors>
<id>a557eeeb-009b-316d-0000-000000000000</id>
<parentGroupId>25bb3a09-a84a-3df9-0000-000000000000</parentGroupId>
<position>
<x>0.0</x>
<y>250.0</y>
</position>
<bundle>
<artifact>nifi-standard-nar</artifact>
<group>org.apache.nifi</group>
<version>1.8.0</version>
</bundle>
<config>
<bulletinLevel>WARN</bulletinLevel>
<comments></comments>
<concurrentlySchedulableTaskCount>1</concurrentlySchedulableTaskCount>
<descriptors>
<entry>
<key>Regular Expression</key>
<value>
<name>Regular Expression</name>
</value>
</entry>
<entry>
<key>Replacement Value</key>
<value>
<name>Replacement Value</name>
</value>
</entry>
<entry>
<key>Character Set</key>
<value>
<name>Character Set</name>
</value>
</entry>
<entry>
<key>Maximum Buffer Size</key>
<value>
<name>Maximum Buffer Size</name>
</value>
</entry>
<entry>
<key>Replacement Strategy</key>
<value>
<name>Replacement Strategy</name>
</value>
</entry>
<entry>
<key>Evaluation Mode</key>
<value>
<name>Evaluation Mode</name>
</value>
</entry>
</descriptors>
<executionNode>ALL</executionNode>
<lossTolerant>false</lossTolerant>
<penaltyDuration>30 sec</penaltyDuration>
<properties>
<entry>
<key>Regular Expression</key>
<value>(?s)(^.*$)</value>
</entry>
<entry>
<key>Replacement Value</key>
<value>$1</value>
</entry>
<entry>
<key>Character Set</key>
<value>UTF-8</value>
</entry>
<entry>
<key>Maximum Buffer Size</key>
<value>1 MB</value>
</entry>
<entry>
<key>Replacement Strategy</key>
<value>Regex Replace</value>
</entry>
<entry>
<key>Evaluation Mode</key>
<value>Entire text</value>
</entry>
</properties>
<runDurationMillis>0</runDurationMillis>
<schedulingPeriod>0 sec</schedulingPeriod>
<schedulingStrategy>TIMER_DRIVEN</schedulingStrategy>
<yieldDuration>1 sec</yieldDuration>
</config>
<executionNodeRestricted>false</executionNodeRestricted>
<name>ReplaceText</name>
<relationships>
<autoTerminate>false</autoTerminate>
<name>failure</name>
</relationships>
<relationships>
<autoTerminate>false</autoTerminate>
<name>success</name>
</relationships>
<state>STOPPED</state>
<style/>
<type>org.apache.nifi.processors.standard.ReplaceText</type>
</processors>
<processors>
<id>e132b9d2-4ae9-3941-0000-000000000000</id>
<parentGroupId>25bb3a09-a84a-3df9-0000-000000000000</parentGroupId>
<position>
<x>0.0</x>
<y>0.0</y>
</position>
<bundle>
<artifact>nifi-standard-nar</artifact>
<group>org.apache.nifi</group>
<version>1.8.0</version>
</bundle>
<config>
<bulletinLevel>WARN</bulletinLevel>
<comments></comments>
<concurrentlySchedulableTaskCount>1</concurrentlySchedulableTaskCount>
<descriptors>
<entry>
<key>URL</key>
<value>
<name>URL</name>
</value>
</entry>
<entry>
<key>Filename</key>
<value>
<name>Filename</name>
</value>
</entry>
<entry>
<key>SSL Context Service</key>
<value>
<identifiesControllerService>org.apache.nifi.ssl.SSLContextService</identifiesControllerService>
<name>SSL Context Service</name>
</value>
</entry>
<entry>
<key>Username</key>
<value>
<name>Username</name>
</value>
</entry>
<entry>
<key>Password</key>
<value>
<name>Password</name>
</value>
</entry>
<entry>
<key>Connection Timeout</key>
<value>
<name>Connection Timeout</name>
</value>
</entry>
<entry>
<key>Data Timeout</key>
<value>
<name>Data Timeout</name>
</value>
</entry>
<entry>
<key>User Agent</key>
<value>
<name>User Agent</name>
</value>
</entry>
<entry>
<key>Accept Content-Type</key>
<value>
<name>Accept Content-Type</name>
</value>
</entry>
<entry>
<key>Follow Redirects</key>
<value>
<name>Follow Redirects</name>
</value>
</entry>
<entry>
<key>redirect-cookie-policy</key>
<value>
<name>redirect-cookie-policy</name>
</value>
</entry>
<entry>
<key>proxy-configuration-service</key>
<value>
<identifiesControllerService>org.apache.nifi.proxy.ProxyConfigurationService</identifiesControllerService>
<name>proxy-configuration-service</name>
</value>
</entry>
<entry>
<key>Proxy Host</key>
<value>
<name>Proxy Host</name>
</value>
</entry>
<entry>
<key>Proxy Port</key>
<value>
<name>Proxy Port</name>
</value>
</entry>
</descriptors>
<executionNode>ALL</executionNode>
<lossTolerant>false</lossTolerant>
<penaltyDuration>30 sec</penaltyDuration>
<properties>
<entry>
<key>URL</key>
<value>https://www.baidu.com</value>
</entry>
<entry>
<key>Filename</key>
<value>index.html</value>
</entry>
<entry>
<key>SSL Context Service</key>
<value>43bd3854-302f-30dd-0000-000000000000</value>
</entry>
<entry>
<key>Username</key>
</entry>
<entry>
<key>Password</key>
</entry>
<entry>
<key>Connection Timeout</key>
<value>30 sec</value>
</entry>
<entry>
<key>Data Timeout</key>
<value>30 sec</value>
</entry>
<entry>
<key>User Agent</key>
</entry>
<entry>
<key>Accept Content-Type</key>
</entry>
<entry>
<key>Follow Redirects</key>
<value>false</value>
</entry>
<entry>
<key>redirect-cookie-policy</key>
<value>default</value>
</entry>
<entry>
<key>proxy-configuration-service</key>
</entry>
<entry>
<key>Proxy Host</key>
</entry>
<entry>
<key>Proxy Port</key>
</entry>
</properties>
<runDurationMillis>0</runDurationMillis>
<schedulingPeriod>10 sec</schedulingPeriod>
<schedulingStrategy>TIMER_DRIVEN</schedulingStrategy>
<yieldDuration>1 sec</yieldDuration>
</config>
<executionNodeRestricted>false</executionNodeRestricted>
<name>GetHTTP</name>
<relationships>
<autoTerminate>false</autoTerminate>
<name>success</name>
</relationships>
<state>STOPPED</state>
<style/>
<type>org.apache.nifi.processors.standard.GetHTTP</type>
</processors>
</snippet>
<timestamp>01/19/2019 02:06:56 CST</timestamp>
</template>

    

  

【NIFI】 Apache NiFI 使用技巧的更多相关文章

  1. 【NIFI】 Apache NiFI 授权配置

    当NIFI未配置需要单向SSL(例如LDAP,OpenId Connect等)的替代认证机制时,NiFi的Web服务器将要求访问用户界面的用户使用基于证书的客户端身份验证.启用备用身份验证机制会将We ...

  2. 【NIFI】 Apache NiFI 集群搭建

    NiFI 集群介绍 NiFi集群架构 NiFi采用Zero-Master Clustering范例.集群中的每个节点对数据执行相同的任务,但每个节点都在不同的数据集上运行.其中一个节点自动选择(通过A ...

  3. 【NIFI】 Apache NiFI 安装及简单的使用

    NiFI介绍 NiFi(NiagaraFiles)是为了实现系统间数据流的自动化而构建的.虽然术语“数据流”用于各种上下文,但我们在此处使用它来表示系统之间的自动和管理信息流 官网地址:http:// ...

  4. 【NIFI】 Apache NiFI 之 ExecuteScript处理(二)

    本例介绍NiFI ExecuteScript处理器的使用,使用的脚本引擎ECMScript 接上一篇[NIFI] Apache NiFI 之 ExecuteScript处理(一) ExecuteScr ...

  5. 【NIFI】 Apache NiFI 之 ExecuteScript处理(一)

    本例介绍NiFI ExecuteScript处理器的使用,使用的脚本引擎ECMScript FlowFile I / O简介 NiFi中的流文件由两个主要组件构成,即属性和内容.属性是关于内容/流文件 ...

  6. 【NIFI】 Apache NiFI 与 SQL 操作

    本里需要基础知识:[NIFI] Apache NiFI 安装及简单的使用 查询SQL 1.拖入一个 Processor:ExecuteSQLRecord(执行sql记录) 2.配置,SETTINGS的 ...

  7. Apache Nifi在Windows环境下搭建伪群集及证书登录

    代码地址如下:http://www.demodashi.com/demo/11986.html 前些时间做了关于Apache Nifi分布式集群的搭建分享,但很多时候要搭建分布式集群机器资源是个问题, ...

  8. Apache Nifi 开发

    Apache NiFi是由美国过国家安全局(NSA)贡献给Apache基金会的开源项目.其设计目标是自己主动化系统间的数据流.基于其工作流式的编程理念.NiFi很易于使用,强大.可靠及高可配置. 两个 ...

  9. Apache NiFi 开发 安装说明

    系统环境: vmware安装的centos6.7虚拟机 jdk1.8版本 maven库3.3.9版本(在使用源码编译启动的时候需要修改配置文件与当前使用的maven版本匹配,最低使用版本好像是3.1. ...

随机推荐

  1. ffplay流程分析

    void main() { is = stream_open(input_filename, file_iformat); } static VideoState *stream_open(const ...

  2. mysql 函数获取子节点

    DELIMITER $$ USE `topsale`$$ DROP FUNCTION IF EXISTS `getShopIdByUserId`$$ CREATE DEFINER=`root`@`%` ...

  3. python实战:用70行代码写了一个山炮计算器!

    python实战训练:用70行代码写了个山炮计算器! 好了...好了...各位因为我是三年级而发牢骚的各位伙伴们,我第一次为大家插播了python的基础实战训练.这个,我是想给,那些python基础一 ...

  4. Oracle 批量修改字段长度

    Oracle 批量修改字段长度 SELECT  'alter table '||a.table_name||' MODIFY  '||A.COLUMN_NAME||' VARCHAR2(100);' ...

  5. [Sw] 使用 Swoole Server task/协程 处理大数据量异步任务时注意

    关于 Buffered Query 和 Unbuffered Query:http://www.php.net/manual/zh/mysqlinfo.concepts.buffering.php 对 ...

  6. 服务主机superFetch占用磁盘过多

    有用户升级到Win10系统后,发现系统运行不快,查看任务管理器中正在运行的进程,然后查看到有一个名称为“服务主机:本地系统(网络受限)”的进程的磁盘占用率很高.如果想要解决这个问题,那么不妨参考下面介 ...

  7. 有关于并发中的死锁(Deadlock)、饥饿(Starvation)、活锁(Livelock)

    最近在看<实战Java高并发程序设计>,发现了之前没有接触过的几个名词. 死锁:之前在接触多线程的时候,接触过死锁的情况.死锁是线程中最糟糕的情况,如下面的图中的四辆车子一样,如果没有一辆 ...

  8. http缓存策略-nginx只缓存js和css不缓存html

    使用缓存,是提升web性能最重要的方式之一. 在开发单页面应用的时候,大量的单静态资源引用都是依赖于html这个文件的.例如: <!doctype html> <html lang= ...

  9. Mysql的隔离级别

    一.首先什么是事务? 事务是应用程序中一系列严密的操作,所有操作必须成功完成,否则在每个操作中所作的所有更改都会被撤消.也就是事务具有原子性,一个事务中的一系列的操作要么全部成功,要么一个都不做. 事 ...

  10. 输入一段字符串,统计其中的数字,字母,空格,其他字符的方法 ----python---

    1.以简单的循环分支实现字符统计 str1 = input("输入字符串:") num=0;word=0;space=0;other=0; for i in str1: if i. ...