Apache nifi 集群安装

原文地址:https://pierrevillard.com/2016/08/13/apache-nifi-1-0-0-cluster-setup/
文章写的很好了,步骤性的英文写得也比较易懂,原样搬过来了,没有再翻译

As you may know a version 1.0.0-BETA of Apache NiFi has been released few days ago. The upcoming 1.0.0 release will be a great moment for the community as it it will mark a lot of work over the last few months with many new features being added.

The objective of the Beta release is to give people a chance to try this new version and to give a feedback before the official major release which will come shortly. If you want to preview this new version with a completely new look, you can download the binaries here, unzip it, and run it (‘./bin/nifi.sh start‘ or ‘./bin/run-nifi.bat‘ for Windows), then you just have to access http://localhost:8080/nifi/.

The objective of this post is to briefly explain how to setup an unsecured NiFi cluster with this new version (a post for setting up a secured cluster will come shortly with explanations on how to use a new tool that will be shipped with NiFi to ease the installation of a secured cluster).

One really important change with this new version is the new paradigm around cluster installation. From the NiFi documentation, we can read:

Starting with the NiFi 1.0 release, NiFi employs a Zero-Master Clustering paradigm. Each of the nodes in a NiFi cluster performs the same tasks on the data but each operates on a different set of data. Apache ZooKeeper elects one of the nodes as the Cluster Coordinator, and failover is handled automatically by ZooKeeper. All cluster nodes report heartbeat and status information to the Cluster Coordinator. The Cluster Coordinator is responsible for disconnecting and connecting nodes. As a DataFlow manager, you can interact with the NiFi cluster through the UI of any node in the cluster. Any change you make is replicated to all nodes in the cluster, allowing for multiple entry points to the cluster.

这里写图片描述

zero-master-cluster

OK, let’s start with the installation. As you may know it is greatly recommended to use an odd number of ZooKeeper instances with at least 3 nodes (to maintain a majority also called quorum). NiFi comes with an embedded instance of ZooKeeper, but you are free to use an existing cluster of ZooKeeper instances if you want. In this article, we will use the embedded ZooKeeper option.

I will use my computer as the first instance. I also launched two virtual machines (with a minimal Centos 7). All my 3 instances are able to communicate to each other on requested ports. On each machine, I configure my /etc/hosts file with:

192.168.1.17 node-3
192.168.56.101 node-2
192.168.56.102 node-1

I deploy the binaries file on my three instances and unzip it. I now have a NiFi directory on each one of my nodes.

The first thing is to configure the list of the ZK (ZooKeeper) instances in the configuration file ‘./conf/zookeep.properties‘. Since our three NiFi instances will run the embedded ZK instance, I just have to complete the file with the following properties:

server.1=node-1:2888:3888
server.2=node-2:2888:3888
server.3=node-3:2888:3888

Then, everything happens in the ‘./conf/nifi.properties‘. First, I specify that NiFi must run an embedded ZK instance, with the following property:

nifi.state.management.embedded.zookeeper.start=true
I also specify the ZK connect string:

nifi.zookeeper.connect.string=node-1:2181,node-2:2181,node-3:2181

As you can notice, the ./conf/zookeeper.properties file has a property named dataDir. By default, this value is set to ./state/zookeeper. If more than one NiFi node is running an embedded ZK, it is important to tell the server which one it is.

To do that, you need to create a file name myid and placing it in ZK’s data directory. The content of this file should be the index of the server as previously specify by the server. On node-1, I’ll do:

mkdir ./state
mkdir ./state/zookeeper
echo 1 > ./state/zookeeper/myid 

operation needs to be done on each node (don’t forget to change the ID).

If you don’t do this, you may see the following kind of exceptions in the logs:Caused by: java.lang.IllegalArgumentException: ./state/zookeeper/myid file is missing

Then we go to clustering properties. For this article, we are setting up an unsecured cluster, so we must keep:

nifi.cluster.protocol.is.secure=false

Then, we have the following properties:

nifi.cluster.is.node=true
nifi.cluster.node.address=node-1
nifi.cluster.node.protocol.port=9999
nifi.cluster.node.protocol.threads=10
nifi.cluster.node.event.history.size=25
nifi.cluster.node.connection.timeout=5 sec
nifi.cluster.node.read.timeout=5 sec
nifi.cluster.firewall.file=

I set the FQDN of the node I am configuring, and I choose the arbitrary 9999 port for the communication with the elected cluster coordinator. I apply the same configuration on my other nodes:

nifi.cluster.is.node=true
nifi.cluster.node.address=node-2
nifi.cluster.node.protocol.port=9999
nifi.cluster.node.protocol.threads=10
nifi.cluster.node.event.history.size=25
nifi.cluster.node.connection.timeout=5 sec
nifi.cluster.node.read.timeout=5 sec
nifi.cluster.firewall.file=

and

nifi.cluster.is.node=true
nifi.cluster.node.address=node-3
nifi.cluster.node.protocol.port=9999
nifi.cluster.node.protocol.threads=10
nifi.cluster.node.event.history.size=25
nifi.cluster.node.connection.timeout=5 sec
nifi.cluster.node.read.timeout=5 sec
nifi.cluster.firewall.file=

We have configured the exchanges between the nodes and the cluster coordinator, now let’s move to the exchanges between the nodes (to balance the data of the flows).

We have the following properties:

nifi.remote.input.host=node-1
nifi.remote.input.secure=false
nifi.remote.input.socket.port=9998
nifi.remote.input.http.enabled=true
nifi.remote.input.http.transaction.ttl=30 sec

Again, I set the FQDN of the node I am configuring and I choose the arbitrary 9998 port for the Site-to-Site (S2S) exchanges between the nodes of my cluster. The same applies for all the nodes (just change the host property with the correct FQDN).

It is also important to set the FQDN for the web server property, otherwise we may get strange behaviors with all nodes identified as ‘localhost’ in the UI. Consequently, for each node, set the following property with the correct FQDN:

nifi.web.http.host=node-1

And that’s all! Easy, isn’t it?

OK, let’s start our nodes and let’s tail the logs to see what’s going on there!

./bin/nifi.sh start && tail -f ./logs/nifi-app.log

If you look at the logs, you should see that one of the node gets elected as the cluster coordinator and then you should see heartbeats created by the three nodes and sent to the cluster coordinator every 5 seconds.

You can connect to the UI using the node you want (you can have multiple users connected to different nodes, modifications will be applied on each node). Let’s go to:

http://node-2:8080/nifi

Here is what it looks like:

这里写图片描述

Screen Shot 2016-08-13 at 7.33.08 PM

As you can see in the top-left corner, there are 3 nodes in our cluster. Besides, if we go in the menu (button in the top-right corner) and select the cluster page, we have details on our three nodes:

这里写图片描述

Screen Shot 2016-08-13 at 7.35.28 PM

We see that my node-2 has been elected as cluster coordinator, and that my node-3 is my primary node. This distinction is important because some processors must run on a unique node (for data consistency) and in this case we will want it to run “On primary node” (example below).

We can display details on a specific node (“information” icon on the left):

这里写图片描述

Screen Shot 2016-08-13 at 7.35.48 PM

OK, let’s add a processor like GetTwitter. Since the flow will run on all nodes (with balanced data between the nodes), this processor must run on a unique processor if we don’t want to duplicate data. Then, in the scheduling strategy, we will choose the strategy “On primary node”. This way, we don’t duplicate data, and if the primary node changes (because my node dies or gets disconnected), we won’t loose data, the workflow will still be executed.

这里写图片描述

Screen Shot 2016-08-13 at 7.45.19 PM

Then I can connect my processor to a PutFile processor to save the tweets in JSON by setting a local directory (/tmp/twitter):

这里写图片描述
Screen Shot 2016-08-13 at 7.52.25 PM

If I run this flow, all my JSON tweets will be stored on the primary node, the data won’t be balanced. To balance the data, I need to use a RPG (Remote Process Group), the RPG will connect to the coordinator to evaluate the load of each node and balance the data over the nodes. It gives us the following flow:

这里写图片描述

Screen Shot 2016-08-13 at 8.00.26 PM

I have added an input port called “RPG”, then I have added a Remote Process Group that I connected to ” http://node-2:8080/nifi ” and I enabled transmission so that the Remote Process Group was aware of the existing input ports on my cluster. Then in the Remote Process Group configuration, I enabled the RPG input port. I then connected my GetTwitter to the Remote Process Group and selected the RPG input port. Finally, I connected my RPG input port to my PutFile processor.

When running the flow, I now have balanced data all over my nodes (I can check in the local directory ‘/tmp/twitter‘ on each node).

That’s all for this post. I hope you enjoyed it and that it will be helpful for you if setting up a NiFi cluster. All comments/remarks are very welcomed and I kindly encourage you to download Apache NiFi, to try it and to give a feedback to the community if you have any.

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/570766.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Html5 学习笔记 --》html基础 css 基础

HTML5 功能 HTML5特点 <!DOCTYPE html> <html lang"zh-cn"> <head><meta charset"utf-8"><title>基本格式</title> </head> <body><a href"http://www.baidu.com">百度</a> </b…

VMware仅主机模式访问外网

原文转载至&#xff1a;https://blog.csdn.net/eussi/article/details/79054622 保证VMware Network Adapter VMnet1是启用状态 将可以连接外网的连接共享属性设置成如下图所示 将VMware Network Adapter VMnet1的IP地址设置成与本机IP不同的网段即可 VMware虚拟网络编辑器VMne…

IE上ORACLE OEM 证书错误 , 导航阻止,无法”继续浏览此网站”

文章转载自&#xff1a;http://blog.51cto.com/cswggod/1193266 仅用于个人学习&#xff0c;知识收藏 本文是我安装ORACLE11g后客户端IE访问不了是出现的&#xff0c;无奈下找OTN上help&#xff0c; 结果很lucky的被解脱了。 网站是&#xff1a;https://forums.oracle.com/for…

testng使用DataProvider+Excel实现DDT

DDT&#xff0c;即数据驱动测试 Data Driver Test&#xff0c;我曾经记录了一篇关于python的DDT框架&#xff08;ExcelDDT数据驱动实例&#xff09;&#xff0c;那么java中的DDT是怎么样的呢&#xff1f;在java中&#xff0c;可以用testng的DataProvider和Excel实现。 首先建一…

Linux安装Oracle12C 过程及遇到的问题

一、环境介绍 1、系统环境&#xff1a;CentOS7.1 Oracle版本&#xff1a;12C 12.1.0 二、安装过程 1、安装过程文档见百度云上的文档 链接&#xff1a;https://pan.baidu.com/s/1nvd07NF 密码&#xff1a;mey9 2、安装完后登录数据库 su oracle source ~/.bash_profiel…

云监控 Ganglia 安装步骤 (含python module)

文章转载自&#xff1a;https://my.oschina.net/duangr/blog/181585 &#xff0c;仅用于个人学习、收藏&#xff0c;转载请注明原作者地址。 前言 最近在研究云监控的相关工具,感觉ganglia颇有亮点,能从一个集群整体的角度来展现数据. 但是安装过程稍过复杂,相关依赖稍多…

ORA-65096: 公用用户名或角色名无效引发的思考

解决方式&#xff1a; alter session set "_ORACLE_SCRIPT"true; alter session set containerPDBORCL;原因&#xff1a;查官方文档得知“试图创建一个通用用户&#xff0c;必需要用C##或者c##开头”&#xff0c;这时候心里会有疑问&#xff0c;什么是common user&am…

VS封装给Unity使用的DLL

首先: 注意两点,一个是选择3.5,Unity最高支持到3.5 然后要选择第二个FrameWork类库 第一个会报错 然后导入Unity dll 我Unity安装在F:\AppLicationWorkSpace\Unity5.6.2\Unity\Editor\Data\Managed 用哪个导入哪个 然后生成 Ok 把生成的DLL放到Unity里就可以使用了 继续写…

hawq state 报错: the database is down, but Ambari shows all hawq services as being

此问题官方有给出解决方案&#xff1a;https://discuss.pivotal.io/hc/en-us/articles/221826748-Pivotal-HDB-state-indicates-the-database-is-down-but-Ambari-shows-all-Pivotal-HDB-services-as-being-up Environment ProductVersionPivotal HDB (HAWQ)2.x Symptom Piv…

OpenLayer学习之矢量地图

一、首先了解下矢量地图和栅格地图 矢量图使用直线和曲线来描述图形&#xff0c;这些图形的元素是一些点、线、矩形、多边形、圆和弧线等等&#xff0c;矢量地图放大和缩小不会失真&#xff08;图片你要是放大一定程度明显可以看出一个一个小格→栅格地图的缺点&#xff09;。为…

文件拷贝(字符、字节)

1.字节流byte&#xff1a;读入到字节数组后&#xff0c;返回一个长度len&#xff0c;如果没有读到数据&#xff0c;len-1 2.字符流char&#xff1a;同样是-1 3.代码生成器&#xff1a;null 一行一行地读 4.键盘录入&#xff0c;写入文件 5.构造器&#xff0c;追加用true 6.类…

HBae找不到协处理器导致RegionServer全部挂掉

一、问题背景&#xff1a; 跟兄弟单位公用一个大数据集群&#xff0c;通过Dataspace结合Kerberos控制数据的访问&#xff0c;我们生产环境中用到的OLAP工具Kylin&#xff0c;在升级Kylin的过程中&#xff0c;由于删除了旧的协处理器&#xff0c;导致原来数据继续去寻找目标协处…

Spark SQL的整体实现逻辑

1、sql语句的模块解析 当我们写一个查询语句时&#xff0c;一般包含三个部分&#xff0c;select部分&#xff0c;from数据源部分&#xff0c;where限制条件部分&#xff0c;这三部分的内容在sql中有专门的名称&#xff1a; 当我们写sql时&#xff0c;如上图所示&#xff0c;在进…

Mysql的高可用方案及主从详细配置

1、常用的高可用MySQL解决方案&#xff1a; 数据库作为最基础的数据存储服务之一&#xff0c;在存储系统中有着非常重要的地位&#xff0c;因此要求其具备高可用性无可厚非。能实现不同SLA(服务水平协定)的解决方案有很多种&#xff0c;这些方案可以保证数据 库服务器在硬件或…

vue3+element plus组件库中el-carousel组件走马灯特效,当图片变动时下面数字也随着图片动态变化

1.效果图 2.html <section style"height:30%"><div class"left-img1-title"><img src"../assets/img/title.png"alt""srcset""><div class"text">回收垃圾数量</div></div>…

数据库MySQL/mariadb知识点——数据类型

数据类型 所谓的列类型&#xff0c;其实就是指数据类型&#xff0c;即对数据进行统一的分类&#xff0c;从系统的角度出发是为了能够使用统一的方式进行管理&#xff0c;更好的利用有限的空间。 在 SQL 中&#xff0c;将数据类型分成了三大类&#xff0c;分别为&#xff1a;数值…

期货大赛项目|九,fileinput插件的应用

引入JS和CSS bundles.Add(new ScriptBundle("~/bundles/fileinputJs").Include( "~/Content/vendors/bootstrap-fileinput-master/js/fileinput.min.js", "~/Content/vendors/bootstrap-fileinput-master/js/locales/zh.js", "~/Scripts/fi…

PLSQL中文显示乱码(问号)

1、输入 select * from V$NLS_PARAMETERS 查看第一行value值是否为简体中文 simplified chinese 实际显示为&#xff1a;AMERICAN 2、设置本地环境变量 &#xff1a;NLS_LANG NLS_LANGAMERICAN_AMERICA.ZHS16GBK NLS_LANG的值为三个划线值拼接而成。 3、重新打开PLSQL…

Mybatis下collections使用pageHelper进行分页

pageHelper在对mybatis一对多分页时造成查询总页数结果不对的情况。 可以做出如下修改&#xff1a; service层&#xff1a; public CommonResult worksList(String userId, int page, int pageSize) throws Exception { PageHelper.startPage(page, pageSize); List<…

解决ubuntu系统root用户下Chrome无法启动问题

说明&#xff1a;本文转载自-https://www.cnblogs.com/hbsygfz/p/8409517.html 由于ubuntu16.04系统自带的是Firefox浏览器&#xff0c;需要安装Chrome浏览器&#xff0c;但是在root用户下安装后发现&#xff0c;Chrome无法正常启动。安装及问题解决具体如下&#xff1a; 1. …