nifi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nathan Gough <>
Subject Re: Zookeeper - help!
Date Tue, 02 Oct 2018 15:25:50 GMT
Check your configs on nifi2. I don't believe that NiFi is starting two instances of Zookeeper
but the ports configured are unintentionally configured to overlap ie. Ports used twice in
different configs where they should be different.

It may be that your has:


where it should be:


noticing that the server.1 and server.2 ranges don't overlap with the client port.

Not sure if this helps, but the following is the relevant config that I have for my NiFi cluster
nodes that run on the SAME machine where and are configured in /etc/hosts:

- clientPort=2180
- nifi.remote.input.socket.port=10440
- nifi.web.http.port=9550
- nifi.cluster.node.protocol.port=11440

/myid (file contents = "1")
/state-management.xml (no changes required)

- clientPort=2181
- nifi.remote.input.socket.port=10441
- nifi.web.http.port=9551
- nifi.cluster.node.protocol.port=11441

/myid (file contents = "2")
/state-management.xml (no changes required)


On 10/2/18, 2:07 AM, "Phil H" <> wrote:

    Hi Andy,
    Thanks for the additional info.  I think I saw a link to that while searching but was
wary since it was such an old version.
    I have two VMs (nifi1, and nifi2) both running NiFi with identical configs, and trying
to use the inbuilt ZK to cluster them.
    If I only mention a single machine within the config (eg: if nifi1 doesn’t refer to
nifi2, or visa versa) I don’t get any start up errors.
    From: Andy LoPresto
    Sent: Tuesday, 2 October 2018 1:00 PM
    Subject: Re: Zookeeper - help!
    Hi Phil, 
    Nathan’s advice is correct but I think he was assuming all other configurations are
correct as well. Are you trying to run both NiFi nodes and ZK instances on the same machine?
In that case you will have to ensure that the ports in use are different for each service
so they don’t conflict. Setting them all to the same value only works if each service is
running on an independent physical machine, virtual machine, or container. 
    I find Pierre’s guide [1] to be a helpful step-by-step instruction list as well as a
good explanation of how the clustering concepts work in practice. When you get that working,
and you’re ready to set up a secure cluster, he has a follow-on guide for that as well [2].
Even as someone who has set up many clustered instances of NiFi, I use his guides regularly
to ensure I haven’t forgotten a step. 
    They were originally written for versions 1.0.0 and 1.1.0, but the only thing that has
changed is the authorizer configuration for the secure instances (you’ll need to put the
Initial Admin Identity and Node Identities in two locations in the authorizers.xml file instead
of just once). 
    Hopefully this helps you get a working cluster up and running so you can experiment. Good
    Andy LoPresto
    PGP Fingerprint: 70EC B3E5 98A6 5A3F D3C4  BACE 3C6E F65B 2F7D EF69
    On Oct 1, 2018, at 2:45 PM, Phil H <> wrote:
    Thanks Nathan,
    I changed the protocol.port to 10002 on both servers.
    On server 1, I now just see endless copies of the second error from my original message
(“KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss”) – I don’t
know if that’s normal when there’s only a single member of a cluster alive and running?
 Seems like the logs will fill up very quickly if it is!
    On server 2, I get a bind exception on the Zookeeper client port.  It doesn’t matter
what I set it to (In this example, I changed it to 10500) I always get the same result.  If
I run netstat when nifi isn’t running, there’s nothing listening on the port.  It’s
like NiFi is starting two Zookeeper instances?!  There’s no repeat of this in the start
up sequence though.  Both servers are running completely vanilla 1.6.0 – I don’t even
have any flow defined yet, this is purely for teaching myself clustering config – so I don’t
know why one is behaving differently to the other.
    2018-10-02 17:36:31,610 INFO [QuorumPeer[myid=2]/] o.a.zookeeper.server.ZooKeeperServer
Created server with tickTime 2000 minSessionTimeout 4000 maxSessionTimeout 40000 datadir ./state/zookeeper/version-2
snapdir ./state/zookeeper/version-2
    2018-10-02 17:36:31,612 ERROR [QuorumPeer[myid=2]/] o.apache.zookeeper.server.quorum.Leader
Couldn't bind to nifi2.domain/ Address already in use (Bind failed)
    	at Method)
    	at org.apache.zookeeper.server.quorum.Leader.<init>(
    	at org.apache.zookeeper.server.quorum.QuorumPeer.makeLeader(
    From: Nathan Gough
    Sent: Tuesday, 2 October 2018 2:22 AM
    Subject: Re: Zookeeper - help!
    Hi Phil,
    One thing I notice with your config is that the cluster.node.protol.port and the zookeeper
ports are the same - these should not be the same. Node.protocol.port is used by NiFi cluster
to communicate between nodes, the zookeeper.connect.string port should be the port that zookeeper
service is listening on. The zookeeper port is configured by the clientPort property in the file. This would make your connect string: 'nifi.zookeeper.connect.string=nifi1.domain:2180,nifi2.domain:2180',
where 2180 is whatever clientPort is configured.
    You can read more about how NiFi uses Zookeeper and how to configure it here:
    Let us know what happens once these properties are configured correctly.
    On 9/30/18, 11:07 PM, "Phil H" <> wrote:
       Hi guys,
       Pulling my hair out trying to solve my Zookeeper problems.  I have two 1.6.0 servers
that I am trying to cluster.
       Here is the except from the properties files – all other properties are default so
omitted for clarity.   The servers are set up to run HTTPS, and the interface works via the
browser, so I believe the certificates are correctly installed.
       Server nifi1.domain:
       Server nifi2.domain:
       I am getting these errors (this is from server 2, but seeing the same on server 1 apart
from a different address, of course):
       2018-10-01 20:54:16,332 INFO [main] Now listening
for connections from nodes on port 10000
       2018-10-01 20:54:16,381 INFO [main] o.apache.nifi.controller.FlowController Successfully
synchronized controller with proposed flow
       2018-10-01 20:54:16,435 INFO [main] o.a.nifi.controller.StandardFlowService Connecting
Node: nifi2.domain:443
       2018-10-01 20:54:16,769 ERROR [Process Cluster Protocol Request-1]
The incoming request did not contain client certificates and thus the DN cannot be extracted.
Check that the other endpoint is providing a complete client certificate chain
       2018-10-01 20:54:16,771 WARN [Process Cluster Protocol Request-1] o.a.n.c.p.impl.SocketProtocolListener
Failed processing protocol message from nifi2 due to org.apache.nifi.cluster.protocol.ProtocolException: peer not
       org.apache.nifi.cluster.protocol.ProtocolException: peer not authenticated
               at org.apache.nifi.cluster.protocol.impl.SocketProtocolListener.getRequestorDN(
               at org.apache.nifi.cluster.protocol.impl.SocketProtocolListener.dispatchRequest(
               at java.util.concurrent.ThreadPoolExecutor.runWorker(
               at java.util.concurrent.ThreadPoolExecutor$
       Caused by:
peer not authenticated
               at org.apache.nifi.cluster.protocol.impl.SocketProtocolListener.getRequestorDN(
               ... 5 common frames omitted
       Caused by: peer not authenticated
               ... 7 common frames omitted
       2018-10-01 20:54:32,249 INFO [Curator-Framework-0] o.a.c.f.state.ConnectionStateManager
State change: SUSPENDED
       2018-10-01 20:54:32,250 ERROR [Curator-Framework-0] o.a.c.f.imps.CuratorFrameworkImpl
Background operation retry gave up
       org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss
               at org.apache.zookeeper.KeeperException.create(
               at org.apache.curator.framework.imps.CuratorFrameworkImpl.checkBackgroundRetry(
               at org.apache.curator.framework.imps.CuratorFrameworkImpl.performBackgroundOperation(
               at org.apache.curator.framework.imps.CuratorFrameworkImpl.backgroundOperationsLoop(
               at org.apache.curator.framework.imps.CuratorFrameworkImpl.access$300(
               at org.apache.curator.framework.imps.CuratorFrameworkImpl$
               at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(
               at java.util.concurrent.ScheduledThreadPoolExecutor$
               at java.util.concurrent.ThreadPoolExecutor.runWorker(
               at java.util.concurrent.ThreadPoolExecutor$

View raw message