NiFi uses zookeeper when clustered for election of both Cluster Coordinator and Primary node. Once a Cluster coordinator has been elected, all nodes in your cluster will start sending heartbeats to that node. If heartbeats are not received in a timely manor, the node may become disconnected. Should the heartbeat from a disconnected node come in later, the node will go through the process of connection to the cluster again.
There are a couple common reason that may cause issues with heartbeats.
1. Network issues (latency/packet loss) between NiFi nodes and/or zookeeper.
2. Excessive Java garbage collection (stop-the-world events) occurring on your NiFi node(s). During GC heartbeats will not be sent.
To see if it is just a small latency issue, try adjusting the following timeout settings in NiFi:
Try changing the "nifi.cluster.node.xxx" timeouts from 5 to 30 seconds.
Try changing the "nifi.zookeeper.xxx" timeouts from 3 to 10 seconds.
These changes will require a NiFi restart to take affect.